using System;
public class Program
{
private static string foo;
public static void Main()
var test = new Test();
Console.WriteLine(test);
test.SetFoo("baz");
}
public class Test
private string foo = "bar";
public void SetFoo(string foo)
// 'this.', um zu unterscheiden, weil Test::foo durch den Parameter foo versteckt wird.
this.foo = foo;
public override string ToString()
return foo;