On Jul 24, 3:37 am, Alphapage <Alphap...@disc ussions.microso ft.com>
wrote:
Why, of course you can:
public void Process<T>(IFoo <Tfoo)
{
...
}
Of course, since Process doesn't know what T could possibly be, it
would be rather limited. But, to take some existing interface as an
example, if we were dealing with ICollection<The re, Process() could
easily access, for example, Count and Clear - other methods would be
more problematic, since you'd need an instance of T to get anything
useful from them.
wrote:
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)
{
...
>
}
>
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)
{
...
>
}
public void Process<T>(IFoo <Tfoo)
{
...
}
Of course, since Process doesn't know what T could possibly be, it
would be rather limited. But, to take some existing interface as an
example, if we were dealing with ICollection<The re, Process() could
easily access, for example, Count and Clear - other methods would be
more problematic, since you'd need an instance of T to get anything
useful from them.