C # does not support the definition of an anonymous implementation of such an interface. Alternatively, you can declare some inner class and return it instead. Example:
public class Derp
{
class Test<T> : TestUtil.ITest<T, T>
{
public string Name(T[] input, T[] iters)
{
return "asdf";
}
public void Run(T[] input, T[] iters)
{
run(input, iters);
}
public void Dispose() {}
}
public TestUtil.ITest<T, T> Foo<T>(T x)
{
return new Test<T>();
}
}
Note that I'm not sure I got the types correctly for your F # code, but this should be a general idea.
source
share