Going through the Microsoft Documentation and Working through the tutorials, I'm currently working on the Classes and Objects Module.
using System;
namespace classes
{
public class BankAccount
{
public string Number { get; }
public string Owner { get; set; }
public decimal Balance { get; }
public BankAccount(string name, decimal initialBalance)
{
this.Owner = name;
this.Balance = initialBalance;
}
public void MakeDeposit(decimal amount, DateTime date, string note)
{
}
public void MakeWithdrawal(decimal amount, DateTime date, string note)
{
}
}
}
is what we start with, and I'm to call upon this class as a test in the Program.cs file
using System;
namespace classes
{
public class Program
{
var account = new BankAccount("<HAMID>", 1000);
Console.WriteLine($"Account {account.Number} was created for {account.Owner} with {account.Balance} initial balance.");
}
}
but i get this error in the Console.WriteLine("...")
"Type expected , tuple must be at least two elements, ) expected, invalid token $"Account {account.Number} was created for {account.Owner} with {account.Balance} initial balance."
The link to the article i'm going by is
https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/intro-to-csharp/introduction-to-classes
appreciate any insight on my dilemma.
You are missing the static void Main(string[] args)
method in your Program
class.
Example:
using System;
namespace classes
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With