I'm trying to execute the following code and can't understand why don't the line person.Name = "anton";
work? The output of the program is "colin".
class Person
{
public string Name;
}
class MainClass
{
public static void MyMethod(Person person)
{
person.Name = "colin";
person = new Person();
person.Name = "anton";
}
public static void Main()
{
Person person = new Person();
person.Name = "felix";
MyMethod(person);
Console.WriteLine(person.Name);
}
}