summaryrefslogtreecommitdiff
path: root/mcs/tests/gtest-150.cs
blob: 31cbe55a22a8b6ce11a48faec72bf2030114046a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
  }
};