Bruno Machado - vargero
Bruno Machado - vargero

Reputation: 2730

How to implement a generic interface which implements another interface?

I've been having this problem for quite sometime. I have an interface, let's say, ITransaction. Now I need to create an interface called IVolatileTransaction<T>, which has to implement ITransaction, but T also has to be an ITransaction.

public interface IVolatileTransaction<T> : ITransaction
public interface IVolatileTransaction<T> where T : ITransaction

The problem is, I need both. Any ideas?

Upvotes: 1

Views: 149

Answers (1)

Marcel N.
Marcel N.

Reputation: 13976

What's wrong with this:

public interface ITransaction
{

}

public interface IVolatileTransaction<T> : ITransaction where T : ITransaction
{

}

Upvotes: 6

Related Questions