2 Replies

#1 − just to get sure


hi marco,

just to get things the right way (as i don’t know java very well):

is this wildcard-thing the same as the “WHERE” in C# 2?

For example:

public class A<MYTYPE>


have to try your examples above in the c# and see if i get this working as well as it looks like a nice exercise for rainy weekends like this ;-)

cheers, marc



Wildcards are a way to provide partial support for propert generics, in which—if B inherits from A—List<B> also inherits from List<A>. In both Java and C#, this is not the case, which makes passing generic parameters all the more difficult.

The where keyword in C# corresponds to the extends keyword in Java. It indicates that the actual generic parameter must conform to the given base type (which can be a class or an interface). In your example, the implementation of the generic class may call any features defined in MYBASETYPE on MYTYPE.