testbed() { c1 o1 = new c1(); //works test.sub.c2 o2 = new test.sub.c2(); //works sub.c2 o3 = new sub.c2(); //works because your are in namespace *test* }
static void Main(string[] args) { //myDelegateType mydlg = new myDelegateType(f1); //mydlg("salam"); c1 o1 = new c1(); c2 o2 = new c2(); DelVal dl; dl = f11; //controvarinace c1 o11 = dl(o2); dl = f11; //covarinace //c2 o12 = (c2) dl(o2); //multicasting myDelegateType mydlg = f1; mydlg += f2; mydlg += f3; mydlg += f4; mydlg += f5; mydlg -= f3; mydlg += Sinif.f1; mydlg("Hi all"); Console.ReadKey(); }
testbed() { c1 o1 = new c1(); //works test.sub.c2 o2 = new test.sub.c2(); //works sub.c2 o3 = new sub.c2(); //don't work }
public c2() { m1 = x_ => { c1 o1 = a1.FirstOrDefault(i_ => i_.p1 == x_.p3); }; }
/* * public void test<T1,T2>(T1 aaa) where T1:CsvData<T2> * { * * } */ public void CallTest() { c1 test = new c1(); MasterStage masterStage = new MasterStage(); sample <MasterStage, c2>(masterStage); sample2 <MasterStage, MasterStageParam>(new MasterStage()); }
private static c1 _init() { c1 o1 = new c1 { p1 = Z1 }; return(o1); }
public static void TestGenericMethodInObjectLiteral() { c1 <string> o1 = new c1 <string>(); object o2 = new object(); object o3 = o1.m1 <int>(o2); Assert.AreEqual(0, o3); Assert.True(o1.Is <c1 <string> >()); Assert.True(o1.m2 <int>(o2)); }
public static void TestLINQ() { var col = new c1 <int>().f1(new string[1] { "" }); Assert.AreEqual(1, col.Count(), "Instantiating c1 works."); Assert.True(col.First() is c1 <int> .c2, "Elements of c1 are of c2's specified type."); Assert.AreEqual(1, col.First().m1, "Value of c1 instance's element from subclass is correct."); }
// Use this for initialization void Start() { obj = GameObject.Find("Cube"); c1 script = obj.GetComponent <c1> (); script.Number = 100; Debug.Log(script.Number); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); c1 cc = new c1(); cc.func1(); c2 ccc = new c2(); ccc.func2(); }
private void Foo() { var str = "string"; var num = 2; var c = new c1().C2; var nest = new c1.Nest(); var n = (Number)num; var list = new List <string>(); var array = new object[] { false, 1, "2" }; var anon = new { Prop1 = false, Prop2 = 1, Prop3 = "2" }; }
static int Main() { Console.WriteLine("Friendly name: " + AppDomain.CurrentDomain.FriendlyName); AppDomainSetup setup = new AppDomainSetup(); setup.ApplicationBase = Directory.GetCurrentDirectory(); AppDomain newDomain = AppDomain.CreateDomain("NewDomain", null, setup); c1 a1 = new c1(); a1.e1.a = 3; a1.e1.s1 = "SS"; newDomain.SetData("TEST", a1); c1 r1 = (c1)newDomain.GetData("TEST"); if (r1.a != 1 || r1.b != 2) { return(1); } if (r1.s1 != "TEST1") { return(2); } if (r1.s2 != null) { return(3); } if (r1.e1.a != 3) { return(4); } if (r1.e1.s1 != "SS") { return(5); } Console.WriteLine("test-ok"); return(0); }
public async static Task <string> bug6() { using (c1 oC1 = new c1()) { string s = await bug6_m(); if (s != "") { return("1" + s); } string z = await bug6_m(); if (z != "") { return("2" + z); } } return(""); }
static int Main () { Console.WriteLine ("Friendly name: " + AppDomain.CurrentDomain.FriendlyName); AppDomainSetup setup = new AppDomainSetup (); setup.ApplicationBase = Directory.GetCurrentDirectory (); AppDomain newDomain = AppDomain.CreateDomain ("NewDomain", null, setup); c1 a1 = new c1 (); a1.e1.a = 3; a1.e1.s1 = "SS"; newDomain.SetData ("TEST", a1); c1 r1 = (c1)newDomain.GetData ("TEST"); if (r1.a != 1 || r1.b !=2) return 1; if (r1.s1 != "TEST1") return 2; if (r1.s2 != null) return 3; if (r1.e1.a != 3) return 4; if (r1.e1.s1 != "SS") return 5; Console.WriteLine("test-ok"); return 0; }
static void Main(string[] args) { c1[] array1 = new c1[10]; c2[] array2 = new c2[10]; for (int i = 0; i < 10; i++) { array1[i] = new c1((i * 7) % 10); array2[i] = new c2((i * 13) % 10); } Console.WriteLine("Before sorting"); PrintArray(array1); PrintArray(array2); BubbleSort(array1); BubbleSort(array2); Console.WriteLine("After sorting"); PrintArray(array1); PrintArray(array2); Console.ReadLine(); }
// Virtual Methods public virtual int virt(ref int x, c1 y, params c2 <string>[] z) { Console.WriteLine(" c1.virt(ref int, c1, params c2<string>[])"); x = x + x * 2; z = null; // Read, Write Ref + Paramarrays return(0); }
public c1(int x, uint y, c1 c) { this.i = x; ui = y; a = new c1(); }
public c1(int x) { i = x; this.ui = 3; this.a = new c1(this.i, this.ui, this.a); }
public bool LargeMethod() { string str = "c4.Test()"; { int i = 2; Console.WriteLine(str); { c1 a = new c1(i); a.foo(i); } double d = 1.1; { sbyte sb = 1; c1 a = new c1(i + (i + i)); a.foo(sb); { a.foo(d); } } // Nested Scopes { object o = i; bool b = false; if (!b) { byte b1 = 1; string s = " This is a test"; while (!b) { if (true) { b = true; } Console.WriteLine(s); while (b) { if (true) { b = false; } object oo = i; bool bb = b; if (!bb) { if (!false) { bb = true; } byte b11 = b1; string ss = s; if (bb) { Console.WriteLine(ss); if (bb != b) { object ooo = i; bool bbb = bb; if (bbb == true) { byte b111 = b11; string sss = ss; while (bbb) { Console.WriteLine(sss); bbb = false; // Method Calls - Ref, Paramarrays // Overloaded Abstract Methods long l = i; c4 c = new c4(); c.abst(ref s, 1, i); c.abst(ref s, new int[] { 1, i, i }); c.abst(ref s, c.abst(ref s, l, l), l, l, l); // Method Calls - Ref, Paramarrays // Overloaded Virtual Methods c1 a = new c4(); c.virt(i, c, new c2 <string>[] { c.virt(i, ref a), new c4() }); c.virt(c.virt(i, ref a), c.virt(ref i, c, c.virt(i, ref a))); c.virt(c.abst(ref s, l, l), c.abst(ref s, new long[] { 1, i, l })); c.virt(i, ref a); c.virt(ref i, new c4(), new c4(), new c2 <string>()); c.virt(new int[] { 1, 2, 3 }); c.virt(new Exception[] { }); c.virt(new c1[] { new c4(), new c2 <string>() }); if (true) { continue; } } } else if (bbb != true) { Console.WriteLine("Error - Should not have reached here"); o = i; return((bool)o); } else if (bbb == false) { Console.WriteLine("Error - Should not have reached here"); o = i; return((bool)o); } else { Console.WriteLine("Error - Should not have reached here"); o = b; return((bool)o); } } } else if (!b) { Console.WriteLine("Error - Should not have reached here"); object o1 = b; return((bool)o1); } else { Console.WriteLine("Error - Should not have reached here"); object o1 = b; return((bool)o1); } } else if (!bb) { Console.WriteLine("Error - Should not have reached here"); o = b; return((bool)o); } else { Console.WriteLine("Error - Should not have reached here"); object o1 = b; return((bool)o1); } while (b != false) { b = false; break; } break; } while (b != true) { b = true; continue; } } } else if (b) { Console.WriteLine("Error - Should not have reached here"); return(b); } else { Console.WriteLine("Error - Should not have reached here"); return((bool)b != true); } } } int us = 0; short sh = 1; c5 cc = new c5(); Console.WriteLine("c5.test"); { uint ui = 1; object o = ui; int i = sh; bool b = false; us = 1; // Nested Scopes if (true) { byte b1 = 1; long l = i; string s1 = ""; string s = ""; float f = 1.2f; o = f; l = ui; c4 c = new c4(); c.foo(sh); this.bar(sh); if (b == false) { double d = f; s1 = s; } if (b1 >= l) { uint ui1 = 1; o = ui1; i = sh; b = false; us = 1; while (i != 1000) { byte b11 = 1; long l1 = i; string s11 = s1; float f1 = 1.2f; o = f1; l1 = ui1; c.foo(b); b11 = (byte)l1; if (!false) { double d1 = f1; s1 = s; c.foo(b1); } if (i != 1000) { uint ui2 = 1; o = ui2; i = sh; b = false; us = 1; { long l2 = i; string s12 = s11; o = f1; l2 = ui1; if (i <= 1000) { break; } } } if (i <= 1000) { i = 1000; } return(false); } } } } return(us == 0); }
public c2() { prop1 = "hello"; _obj1 = new c1(); }
private void button2_Click(object sender, EventArgs e) { c1 x = new c1(); //用new 建立類別實體 textBox2.Text = x.Touppser(textBox2.Text); //使用類別的方法 }
assertTrue(c1 == c2);
public bool m2 <TB>(object p1) { c1 <TA> oThis = this; return(oThis.Is <c1 <TA> >()); }
public static void TestPropertyInitializerWithDirective() { var c1 = new c1(); Assert.AreEqual("test", c1.p1); }
AssertEquals(c1.getClass(), C.class);
public virtual c2 <string> virt(int x, ref c1 y) { Console.WriteLine(" c1.virt(int, ref c1)"); y = new c1(); // Read, Write Ref return(new c4()); }
public void test(c1 c) { c.A = 5; }
return(Collide(c1, c2, out result));
public static c1 f11(c1 ob) { Console.WriteLine("ret-type:c1 arg-list:c1"); return(new c1()); }