I've studied Java for a long time and I'm well acquainted with the working of generic types in this language: I know there are only compile-time, type type erasure end of it (so that at runtime this information is not available), and I have a certain sense of difficulties in applying polymorphism in generic types .
Now I'm learning C #, and I noticed that although this language uses similar notation ( Tipo<TipoGenerico>
) the semantics does not seem to be the same. For example, when viewing this question I understood that the C # runtime holds generic type information instead of discarding it, unlike Java, is this correct? Also, I have never seen an example in C # that uses wildcards as Tipo<? extends TipoGenerico>
. Is this possible (or even necessary) in this language?
Finally, does C # support generic (and not just generic) methods? If so, what is the equivalent syntax of this construct in Java:
public <T> void metodo(T parametro1, List<T> parametro2) {
If there is any additional detail worth highlighting, or perhaps some reference material to learn more, you will also be welcome.