A
Alphapage
Hello,
The problem I've come across is that I want to use an interface as an
abstraction. For example, if i have some interface:
public interface IFoo<T>
{
...
}
I can't just refer to it in another class like a non generic interface:
public void process(IFoo foo)
{
...
}
It has to be referred to as something like IFoo<T> to bind it to a specific
T. You can't just refer to a common IFoo method, you have to refer to a
common IFoo method bound to a specific type T, so although your code might
look like its dealing with interfaces in order to actually use this generic
interface pattern you have to keep track of the type argument! This doesn't
seem like much of an abstraction. Ideally an object in random assembly "X"
that knows about interface IFoo should be able to accept an object of type
IFoo in method parameters and be able to call functions defined in the
interface IFoo, but with a generic interface this assembly also needs to know
what the type T is, which seems like a limitation.
Thanks in advance for your help.
The problem I've come across is that I want to use an interface as an
abstraction. For example, if i have some interface:
public interface IFoo<T>
{
...
}
I can't just refer to it in another class like a non generic interface:
public void process(IFoo foo)
{
...
}
It has to be referred to as something like IFoo<T> to bind it to a specific
T. You can't just refer to a common IFoo method, you have to refer to a
common IFoo method bound to a specific type T, so although your code might
look like its dealing with interfaces in order to actually use this generic
interface pattern you have to keep track of the type argument! This doesn't
seem like much of an abstraction. Ideally an object in random assembly "X"
that knows about interface IFoo should be able to accept an object of type
IFoo in method parameters and be able to call functions defined in the
interface IFoo, but with a generic interface this assembly also needs to know
what the type T is, which seems like a limitation.
Thanks in advance for your help.