Cool Guy,
This is handled by the CLR. The CLR will create a separate type
definition for every distinct combination of value types used in a generic
type as type parameters. So, if you have Stack<int> and Stack<byte>, the
CLR will actually create two type definitions.
If you have a Stack<Customer> and Stack<Order> where Customer and Order
are reference types, then the CLR creates one type definition to use between
the two of them. The reason for this is that you are not dealing with the
actual memory that instances of the type take up, but rather, references,
which are all one, constant size.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Cool Guy" <co*****@abc.xyz> wrote in message
news:1r***************@cool.guy.abc.xyz...
From
<http://msdn2.microsoft.com/en-us/library/f4a6ta2h(en-US,VS.80).aspx>:
| As with the previous use of the Stack<T> class created with the Order
| type, another instance of the specialized Stack<T> class is created,
| and the pointers contained therein are set to reference an area of
| memory the size of a Customer type.
I don't quite get this. Where in memory do these changes (the pointers
getting set) take place?