short i = (int)myInts[0];
Console.WriteLine("Value of your int: {0}", i);
Console.ReadLine();
}
In an ideal world, the C# compiler would be able to resolve these illegal unboxing operations at
of value types in a container that did not require boxing in the first place. Generics are the solution
to each of these issues. The Issue of Type Safety and Strongly Typed Collections
The final major collection-centric issue we have in a generic-free programming world is the fact
that a majority of the types of System.Collections can typically hold anything whatsoever, as their
members are prototyped to operate on System.Objects:
C H A P T E R 1 0 ■
C O L L E C T I O N S A N D G E N E R I C S
8849CH10.qxd 9/25/07 4:17 PM Page 319
{