List<T> Foo<T>(Ilist list)
where T : ??
is there any way to enforce T to be
one of few classes ?
eventually i want to do a switch on T..
thanks.
You can require that each class you want to allow into your list implements some interface ISomething
and then create a List<ISomething>
.
eventually i want to do a switch on T..
Instead of a switch on the type of the object it might be better to have a method in your interface and implement it differently for each class.