public static void Delegate() { MyStruct myStruct = new MyStruct(10); myStruct.Increment(); MyDelegate increment = new MyDelegate(myStruct.Increment); increment(); myStruct.Increment(); }
public static void AnonymousDelegate() { MyStruct myStruct = new MyStruct(20); myStruct.Increment(); Action increment = new Action(delegate { myStruct.Increment(); }); increment(); myStruct.Increment(); }
public static void Action() { MyStruct myStruct = new MyStruct(30); myStruct.Increment(); Action increment = myStruct.Increment; increment(); myStruct.Increment(); }