"java wildcard" to C#? -
how convert "java wildcards" c# format?
public abstract class aaa<t extends bbb<?>> extends ccc<t>{}
my incorrect c# code
public abstract class aaa<t> : ccc<t> t : bbb<?>{}
how convert bbb<?>
there similar question c# generic "where constraint" "any generic type" definition? not specific java wildcards. answer provided there you.
from answer, possible class signature be:
public abstract class aaa<t, tother> : ccc<t> t : bbb<tother> {}
generics in c# must have named type parameters if never plan use type explicitly/implicitly. , type parameters must named in identifier declaration of method/class/interface.
note possible constrain tother object types if desired using:
public abstract class aaa<t, tother> : ccc<t> t : bbb<tother> tother : object {}
Comments
Post a Comment