Hello, I’m working on this task:
Create a class User with two public fields: int Age and string Name. In the Main method, create an object of class User and set Name to “Teo” and Age to 24. Then, output to the screen: “My name is {Name} and I’m {Age} years old.” using object fields for Name and Age.
Here is my code:
namespace ClassAndObject
{
class User
{
public string Name;
public int Age;
}
class ThisIsMyName
{
public static void Main()
{
var object = new User
{
Name = "Teo",
Age = 24
};
Console.WriteLine($"My name is {object.Name} and I'm {object.Age} years old.");
}
}
}
Can anyone please help me to solve it?