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 }
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 }