What is the advantage of using constraints on C# Generics

Posted by user313197 on Stack Overflow See other posts from Stack Overflow or by user313197
Published on 2010-05-22T00:09:42Z Indexed on 2010/05/22 0:10 UTC
Read the original article Hit count: 128

Filed under:
|

Can someone tell me what the difference is between the following

public class CarCollection:List where T:Car {

}

and

public class CarCollection:List {

}

To me they seem to do the same thing, create type-safe collection of "Car" objects.

© Stack Overflow or respective owner

Related posts about c#

Related posts about generics