C# interface specfying a generic return type
c#, generics, interface
Solution
If the whole interface should be generic:
public interface IExample<T>
{
int GetInteger();
T GetAnything();
}
If only the method needs to be generic:
public interface IExample
{
int GetInteger();
T GetAnything<T>();
}
Problem
I have something like: ``` public interface IExample { int GetInteger() T GetAnything(); //How do I define a function with a generic return type??? ^^^^^ } ``` Is this possible???