private int FunctionInTest(MyUnion union) { return union .Match( integer => integer + 100, str => (str + "sadf").Length, datTime => datTime.Year, boolean => !boolean ? 1 : 0); }
public static void Main() { MyUnion mu = new MyUnion(); mu.i = 99; LibWrap.TestUnion(mu, 1); mu.d = 99.99; LibWrap.TestUnion(mu, 2); MyUnion2_1 mu2_1 = new MyUnion2_1(); mu2_1.i = 99; LibWrap.TestUnion2(mu2_1, 1); MyUnion2_2 mu2_2 = new MyUnion2_2(); mu2_2.str = "*** string ***"; LibWrap.TestUnion2(mu2_2, 2); }
public static extern void TestUnion(MyUnion u, int type);
internal static extern void TestUnion(MyUnion u, int type);