static void main2() { GrowableArray <double> ga = new GrowableArray <double>(); int i = 7; ga.AddElement(i); }
public GrowableArrayGenericUser() { GrowableArray <int> ga = new GrowableArray <int>(); int num = 10; ga.AddElement(num); //no boxing operation here int newNum = (int)ga.GetElement(0); //type safety and no unboxing operation // string str = (string)ga.GetElement(0); //would not compile }
public GrowableArrayUser() { GrowableArray ga = new GrowableArray(); int num = 10; ga.AddElement(num); //boxing operation here int newNum = (int)ga.GetElement(0); //no type safety and unboxing operation string str = (string)ga.GetElement(0); //runtime error here }