M
Michael S
When reading about generics, one benefit is to have different
implementations depending on reference/value type. As far as I know, List<T>
does not box/unbox ValueTypes.
How do they do that? A lot of if/else statements in the list?
Or can you do something like
class MyList<T> where T : struct
{
//implementation for ValueTypes
}
class MyList<T> where T : class
{
//implementation for Object
}
Obviously the above does not compile. While lost in msdn searching
aimlessly; usenet is my last hope of enlightment.
Thanks
- Michael S
implementations depending on reference/value type. As far as I know, List<T>
does not box/unbox ValueTypes.
How do they do that? A lot of if/else statements in the list?
Or can you do something like
class MyList<T> where T : struct
{
//implementation for ValueTypes
}
class MyList<T> where T : class
{
//implementation for Object
}
Obviously the above does not compile. While lost in msdn searching
aimlessly; usenet is my last hope of enlightment.
Thanks
- Michael S