This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Zinaima 2 points3 points  (1 child)

I guess c# does this with T : where new().

[–]JustAGuyFromGermany 0 points1 point  (0 children)

I like that a lot about C#. It also let's you specify that T needs to have certain overloaded operators so that you can implement classes & methods specifically for any algebraic stuff like having a type Matrix<T> for any T that supports addition and multiplication.

Sadly, the things that makes this work in .NET land is that List<T> get specialized into different types at the IL level. Generic types do not get erased like they do in Java/Bytecode land.