I\'m drawing a blank on this one and can\'t seem to find any previous example that I wrote. I\'m trying to implement a generic interface with a class. When I implement the inter
I think you probably want to redefine your interface like this:
public interface IOurTemplate
where T : class
where U : class
{
IEnumerable List();
T Get(U id);
}
I think you want the methods to use (re-use) the generic parameters of the generic interface in which they're declared; and that you probably don't want to make them generic methods with their own (distinct from the interface's) generic parameters.
Given the interface as I redefined it, you can define a class like this:
class Foo : IOurTemplate
{
public IEnumerable List() { ... etc... }
public Bar Get(Baz id) { ... etc... }
}
Or define a generic class like this:
class Foo : IOurTemplate
where T : class
where U : class
{
public IEnumerable List() { ... etc... }
public T Get(U id) { ... etc... }
}