Reputation: 360
I rewrite the code with java on .net c # confronted with the problem of transfer classes with wildcard. There are two classes
public abstract class Client <T extends Connection <? >>
public class Connection <T extends Client <? >>
I thought we could have done so
public abstract class Client <T> where Connection <U>
but it turned out that even here does not work
public abstract class Client <T, U> where Connection <T, U>
public abstract class Connection <T, U> where Client <T, U>
so how to get out of the situation?
Upvotes: 0
Views: 90
Reputation: 34199
You can do the following:
public class Connection<T>
{
}
public abstract class Client<T, U> where T : Connection<U>
{
}
Upvotes: 2