When we define an object, we must specify its type. The type determines the kind of values the object can hold and the permissible range of those values. For example, byte is an unsigned integral type with a size of 8 bits. The definition
declares that b can hold integral values, but that those values must be within the range of 0 to 255. If we attempt to assign b a floating-point value:
b = 3.14159; // compile-time error
a string value:
b = "no way"; // compile-time error
or an integer value outside its range:
b = 1024; // compile-time error
each of those assignments is flagged as a type error by the compiler. This is true of the C# array type as well. So why is an ArrayList container able to hold ...