-1

This question already has an answer here:

How can I do this in C#?

  public class SomeClass<T extends  SomeInterface>{}

This is a generic class of T, and T must implement the interface SomeInterface.

2 답변


4

You need to use where constraint clause:

public class SomeClass<T>
   where T : SomeInterface
{}


2

With type constraints:

public class SomeClass<T> where T : SomeInterface

See: http://msdn.microsoft.com/en-us/library/d5x73970.aspx

Linked


Related

Latest