How do I implement the function defined in the interface below? When I implemented in VS2010 like I have below. MyType gets greyed out and it doesn’t recongise the type anymore? thanks!
public interface IExample
{
T GetAnything<T>();
}
public class MyType
{
//getter, setter here
}
public class Get : IExample
{
public MyType GetAnything<MyType>()
{ ^^^^^^^ ^^^^^^
MyType mt = new MyType();
^^^^^^^^^^^^^^^^^^^^^^^^^^ /* all greyed out !!*/
}
}
Make a generic
interface IExample<T>and then implement it using the concrete typeclass Get : IExample<MyType>as in the example below.