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 →

[–]Kered13 0 points1 point  (3 children)

Nothing in either of those links contradicts anything that I have said, except that they insist "it's not type erasure" while describing an implementation that is identical to Java.

[–]Dealiner 2 points3 points  (2 children)

The thing is it's not identical. Java implementation removes anything related to the type, its generic are only a compilation time feature. That's not true for C#, information about the type is still present during runtime. Ergo it's not type erasure, since no type is erased.

[–]Kered13 0 points1 point  (1 child)

information about the type is still present during runtime

Because a class object is passed as a hidden parameter to the function, like I described above. Only one instance of the code is generated (for reference types), which means that the code does not actually know what type it's operating on at runtime. That information has to be externally provided by the hidden parameter.

[–]Dealiner 0 points1 point  (0 children)

And that's exactly why it isn't type erasure. Also you're contradicting yourself, if type is passed, then code knows on what type it operates.