using System.Collections.Generic;
public static void Main()
var list = new List<Test>() { new Test(1), new Test(2), new Test(3) };
list.ForEach(PrintTestObject);
public static void PrintTestObject(Test obj)
Console.WriteLine(obj.ToString());
private readonly int _value;
public override string ToString()
return "Test2: " + _value;