public static unsafe void Entry() { char *[] cc = null; int *[] ii = null; short *[] ss = null; var cls = new Sub2(); cls.Foo(cc, ii); cls.Foo(cc, ss); Inf <int *[]> inf = cls; inf.Foo(cc, ii); Inf2 <short *[]> inf2 = cls; inf2.Foo(cc, ss); var cls2 = new Cls <long *[]>(); Sub1 <int *[]> s1 = cls; s1.Foo(cc, ii); s1.Foo(cc, ss); new Cls <int *[]>(); }
public static void Entry() { IInf inf = new Sub1(); inf.foo(123); inf = new Sub2(); inf.foo(456); }
public static int Entry() { char *[] cc = new char *[1]; int *[] ii = new int *[1]; short *[] ss = new short *[1]; var cls = new Sub2(); cls.Foo(cc, ii); if (path != 1) { return(1); } cls.Foo(cc, ss); if (path != 2) { return(2); } Inf <int *[]> inf = cls; inf.Foo(cc, ii); if (path != 1) { return(3); } Inf2 <short *[]> inf2 = cls; inf2.Foo(cc, ss); if (path != 2) { return(4); } var cls2 = new Cls <long *[]>(); Sub1 <int *[]> s1 = cls; s1.Foo(cc, ii); if (path != 1) { return(5); } s1.Foo(cc, ss); if (path != 2) { return(6); } new Cls <int *[]>(); return(0); }
static void Main(string[] args) { ParentClass parentClass = new ParentClass(5.5); Sub2 sub2 = new Sub2(); // sub2.calculate(12.2); sub2.calculation(5); Console.WriteLine(""); }
public void TestDispatchFunc() { var sub1Orig = new Sub1(); var sub2Orig = new Sub2(); var dispatcher = new PerTypeDispatcher<Base, Base>(false) { (Sub1 sub1) => sub1, (Sub2 sub2) => sub2 }; dispatcher.Dispatch(sub1Orig).Should().BeSameAs(sub1Orig); dispatcher.Dispatch(sub2Orig).Should().BeSameAs(sub2Orig); }
public void TestDispatchFunc() { var sub1Orig = new Sub1(); var sub2Orig = new Sub2(); var dispatcher = new PerTypeDispatcher <Base, Base>(false) { (Sub1 sub1) => sub1, (Sub2 sub2) => sub2 }; dispatcher.Dispatch(sub1Orig).Should().BeSameAs(sub1Orig); dispatcher.Dispatch(sub2Orig).Should().BeSameAs(sub2Orig); }
static void Main(string[] args) { while (true) { Console.WriteLine("" + "Choose Implementation:\n" + "1)Echo\n" + "2)EchoNotify\n" + "3)EchoNotifyBinding\n" + "4)EchoNotifyBindingAlternating"); var imput = Console.ReadLine(); int caseswitch; if (imput == "q") { return; } else if (imput == "1" || imput == "2" || imput == "3" || imput == "4") { caseswitch = int.Parse(imput); switch (caseswitch) { case (1): Sub1.Run(); break; case (2): Sub2.Run(); break; case (3): Sub3.Run(); break; case (4): Sub4.Run(); break; } } else { Console.WriteLine("invlaid keypress"); } } }
public ConstructorDestType(Sub1 value, IEnumerable <Sub1> valueList, Sub2 valueEnum) { if (value == null) { throw new ArgumentNullException("value"); } if (valueList == null) { throw new ArgumentNullException("valueList"); } if (!Enum.IsDefined(typeof(Sub2), valueEnum)) { throw new ArgumentOutOfRangeException("valueEnum"); } _value = value; _valueList = valueList; _valueEnum = valueEnum; }
public void TestDispatchAction() { var sub1Orig = new Sub1(); Sub1 sub1Dispatched = null; var sub2Orig = new Sub2(); Sub2 sub2Dispatched = null; var dispatcher = new PerTypeDispatcher<Base>(false) { (Sub1 sub1) => sub1Dispatched = sub1, (Sub2 sub2) => sub2Dispatched = sub2 }; dispatcher.Dispatch(sub1Orig); sub1Dispatched.Should().BeSameAs(sub1Orig); dispatcher.Dispatch(sub2Orig); sub2Dispatched.Should().BeSameAs(sub2Orig); }
public void TestDispatchAction() { var sub1Orig = new Sub1(); Sub1 sub1Dispatched = null; var sub2Orig = new Sub2(); Sub2 sub2Dispatched = null; var dispatcher = new PerTypeDispatcher <Base>(false) { (Sub1 sub1) => sub1Dispatched = sub1, (Sub2 sub2) => sub2Dispatched = sub2 }; dispatcher.Dispatch(sub1Orig); sub1Dispatched.Should().BeSameAs(sub1Orig); dispatcher.Dispatch(sub2Orig); sub2Dispatched.Should().BeSameAs(sub2Orig); }
public void IfIsATest() { Base s1 = new Sub1(); Base s2 = new Sub2(); Base s3 = new Sub3(); s1.IfIsA((Sub1 s) => { s.Value = 2; }); Assert.AreEqual(2, ((Sub1)s1).Value); s2.IfIsA((Sub1 s) => { s.Value = 3; }); Assert.AreEqual(42, ((Sub2)s2).Value); Assert.AreEqual(2, s1.IfIsA((Sub1 s) => s.Value)); Assert.AreEqual(0, s1.IfIsA((Sub2 s) => s.Value)); Assert.AreEqual(2, s1.IfIsA((Sub1 s) => s.Value, (Sub2 s) => s.Value)); Assert.AreEqual(42, s2.IfIsA((Sub1 s) => s.Value, (Sub2 s) => s.Value)); Assert.AreEqual(0, s3.IfIsA((Sub1 s) => s.Value, (Sub2 s) => s.Value)); }
public static void Entry() { Inf inf = new Sub2(); inf.Foo(); }