tags:

views:

96

answers:

1

Basic C# syntax question:

So I have this class

public class BrandQuery<T> : Query<T> where T : Ad
{
  //...
}

How do I specify that BrandQuery implements an interface, say IDisposable ?

This is obviously the wrong way:

public class BrandQuery<T> : Query<T> where T : Ad, IDisposable
{
  //...
}

because that would only put a generic constraint on T.

+8  A: 

The generic type constraints follow all the base-class / interfaces:

public class BrandQuery<T> : Query<T>, IDisposable
    where T : Ad
{
  //...
}
Marc Gravell