Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

19 lines
479 B
C#

using System;
static class Test1 {
public interface IOp<T> {
T Func(uint v);
}
public struct Op : IOp<ushort>, IOp<uint> {
ushort IOp<ushort>.Func(uint v) { return (ushort )(v * 2); }
uint IOp<uint>.Func(uint v) { return v * 4; }
}
static void Foo<T,OP>(uint v) where T:struct where OP : IOp<T> {
OP op = default(OP);
System.Console.WriteLine( op.Func(v) );
}
static public void Main() {
Foo<ushort, Op>(100);
Foo<uint, Op>(100);
}
};