static void Main(string[] args) { Numberchanger <int> nc1 = new Numberchanger <int>(AddNum); nc1(88); Console.WriteLine(n); //88+n - 88+10 MygenericArray <int> intArray = new MygenericArray <int>(5); for (int c = 0; c < 5; c++) { intArray.SetItem(c, c * 5); } for (int c = 0; c < 5; c++) { Console.Write(intArray.GetItem(c) + " "); } Console.WriteLine(); intArray.GenericMethod <string>("Hallo"); MygenericArray <char> charArray = new MygenericArray <char>(5); for (int c = 0; c < 5; c++) { charArray.SetItem(c, (char)(c + 97)); } for (int c = 0; c < 5; c++) { Console.Write(charArray.GetItem(c) + " "); } Console.WriteLine(); }
static void Main(string[] args) { //system.Delegate, delegate Numberchanger nc1 = new Numberchanger(Addnum); nc1(25); Console.WriteLine("value of Num {0}", num); Myclass mc = new Myclass(); Numberchanger nc2 = new Numberchanger(mc.Addnum); nc2(35); Console.WriteLine("value of instance:{0}", mc.num); Numberchanger nc3 = new Numberchanger(mc.Multinum); nc3(2); Console.WriteLine("value of instance:{0}", mc.num); Console.ReadLine(); }