using System; using System.Reflection; using System.Runtime; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; namespace A { [DefaultMemberAttribute("Item")] public class d { [C()] private sealed class A : MulticastDelegate { public A(object , IntPtr ); public override string Invoke(int ); public virtual IAsyncResult A(int , AsyncCallback , object ); public virtual string A(IAsyncResult ); } [SerializableAttribute()] [StructLayoutAttribute(LayoutKind.Sequential, CharSet=CharSet.Unicode)] protected internal class a { private int A; private a(int ) { } } private const bool A = true; private const byte A = byte.MaxValue; private const int A = 1; private const string A = "John"; [C(true)] private const d A = null; protected int a; private readonly int B = 1000; private readonly string a = "luo"; [MarshalAs(UnmanagedType.LPStr)] public string B; [MarshalAs(UnmanagedType.ByValArray, SizeConst=20)] private int[] A; [MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)] public string b; private byte[] A = new byte[10]; private static E A; private int b = 100; public virtual int A() { return a; } [C(false, Kind=1000)] public virtual void A(int ) { a = ; } public byte A(long ) { return A[(int)]; } public void A(long , byte ) { A[(int)] = ; } protected static void A(E ) { A = (E)Delegate.Combine(A, ); } protected static void a(E ) { A = (E)Delegate.Remove(A, ); } protected virtual void A(EventArgs ) { if (A != null) { A.Invoke(this, ); } } private d() { } protected d(int ) { a = ; } protected d(int , string ) : this() { Console.WriteLine(); } public static void A(string[] ) { new d(100); Console.WriteLine("John"); Console.WriteLine("\u0003Hello World\n\n"); a(); long l = 1000; double d1 = 12.3; A(new object[]{l, d1}); new d(100).A(); B(); A(5); B((long)6); A(); a(4); A(true); A(false); a(true); a(false); d D = new d(100); D.a(); D = new D(1000); D.a(); Console.WriteLine(D.A().a); D.b(); D.C(); D.A(1000); Console.WriteLine("Testing property Which = {0}", D.A()); Console.WriteLine("Testing indexer ..."); D.A((long)0, 100); Console.WriteLine(D.A((long)0)); } private static int A(params object[] ) { return 0; } private void A() { int i = 0; int j = b += 10; Console.WriteLine(String.Concat("You should see 110 here : ", j)); Console.WriteLine(String.Concat("You should see 110 here : ", (i = b))); } private static void A() { int[] nums1 = new int[10]; string[] strs = new string[10]; for (int i = 0; i < (int)nums1.Length; i++) { nums1[i] = i; strs[i] = "Christina Zhang"; } Console.WriteLine(nums1[3]); Console.WriteLine(strs[3]); int[,] nums2 = new int[10, 10]; int[,] nums3 = new int[6, 20]; } private static void a() { int i = 100; if (i < 100) { i++; } else { i--; } bool flag1 = false; bool flag2 = flag1 == false; Console.WriteLine(i); } private static void B() { int i = 0; for (int j = 0; (long)j < (long)1000; j++) { i++; } Console.WriteLine(i); } private static void A(int ) { for (int i = 0; i < ; i++) { Console.WriteLine(i); } } private static void A(long ) { ++; for (int i = 0; i < 5; i++) { if (i != 2) { ++; } } Console.WriteLine(); } private static void a(long ) { int i; ++; for (i = 0; i < 5 && i != 2; i++) { ++; } Console.WriteLine(); } private static void B(long ) { ++; int i = 0; int j = 0; for (i = 0; i < 5; i++) { for (j++; (long)j < ; j++) { if (j == 4) { goto IL_000a; } } ++; } Console.WriteLine((int)); } private int A(int ) { int i; for (i = 0; i < ; i++) { if (i != 0) { i++; i += 5; if (i == 10) { break; } } } int j = i; return j; } private static void a(int ) { string str = null; switch () { case 1: str = "Jan"; break; case 2: str = "Feb"; break; case 3: str = "Mar"; break; case 4: str = "Apr"; break; case 5: str = "May"; break; case 6: str = "Jun"; break; case 7: str = "Jul"; break; case 8: str = "Aug"; break; case 12: str = "Dec"; break; default: str = "Default"; break; } Console.WriteLine(str); } private static void B(int ) { string str = null; switch () { case 1: str = "Jan"; goto IL_0066; case 2: str = "Feb"; break; case 3: str = "Mar"; break; case 4: str = "Apr"; break; case 5: str = "May"; break; case 6: str = "Jun"; break; case 7: str = "Jul"; break; case 8: str = "Aug"; break; case 12: str = "Dec"; break; default: str = "Default"; break; } Console.WriteLine(str); } private static void b(int ) { string str = null; switch () { case 1: if (str != null) { goto IL_006d; } str = "Jan"; break; case 2: str = "Feb"; break; case 3: str = "Mar"; break; case 4: str = "Apr"; break; case 5: str = "May"; break; case 6: str = "Jun"; break; case 7: str = "Jul"; break; case 8: str = "Aug"; break; case 12: str = "Dec"; break; default: str = "Default"; break; } Console.WriteLine(str); } private static void A(bool ) { try { B(); } catch (c C) { Console.WriteLine(C.A); } } private static void a(bool ) { try { B(); } catch (c C) { Console.WriteLine(C.A); } finally { Console.WriteLine("Finally clause called"); } } private static void B(bool ) { if () { throw new c(); } else { return; } } internal virtual void a() { d D; Console.WriteLine("SimpleTest.testLock() called"); int i = 0; Monitor.Enter(D = this); try { i++; } finally { Monitor.Exit(D); } } internal void B() { } internal D A() { Console.WriteLine("testConstructor() ..."); Type type = typeof(D); Type[] types = new Type[]{typeof(int)}; ConstructorInfo constructorInfo = type.GetConstructor(52, null, types, null); object[] locals = new object[]{100}; return (D)constructorInfo.Invoke(locals); } private void b() { int[] nums2 = new int[]{4, 5, 6, 1, 2, 3, -2, -1, 0}; for (int j = 0; j < (int)nums2.Length; j++) { Console.WriteLine(nums2[j]); } } private static string A(int ) { string str; if ( > 0) { str = "positive"; } else if ( < 0) { str = "negative"; } else { str = "zero"; } return str; } private void C() { A a = new A(null, A); Console.WriteLine("{0} is {1};", 5, a.Invoke(5)); } private bool A(out int ) { = 34; return true; } private bool a(ref int ) { = 34; return true; } private void a(int ) { int j; if ( != 0) { int i = 50; j = 200; } } [DllImportAttribute("HelloCS.dll", EntryPoint="pinvokeTest", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)] private static extern void b(); [DllImportAttribute("HelloCS.dll", EntryPoint="writeMessage")] private static extern void C(); [DllImportAttribute("HelloCS.dll", EntryPoint="pinvokeTest2", ExactSpelling=true, CharSet=CharSet.Ansi)] private static extern void c(); [DllImportAttribute("HelloCS.dll", EntryPoint="pinvokeTest3", ExactSpelling=true, CharSet=CharSet.Ansi, PreserveSig=false)] private static extern void D(); private void A([MarshalAs(UnmanagedType.LPArray, SizeConst=40)] int[] ) { } [return: MarshalAs(UnmanagedType.IDispatch)] public object A([MarshalAs(UnmanagedType.LPStr)] string , int , [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] int[] ) { return null; } public void a([MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_PTR)] int[] ) { } public void B([MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_UI8 | VarEnum.VT_VECTOR)] int[] ) { } public void b([MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_I8 | VarEnum.VT_BYREF)] int[] ) { } public void C([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType="SimpleMarshaler")] int[] ) { } [C("Christina", "Zhang")] private void B([C(true)] int ) { } [C(typeof(String), "Zhang")] [return: C(true)] private int a() { return 100; } [C(new string[]{"Christina", "Zhang", "124"})] private void c() { } [C(TypeAttributes.Public, false)] private void D() { } [C(true)] private void d() { } [C(b.B)] private void E() { } [C(false, name="NamedField")] private void e() { } [C(Kind=100)] private void F() { } [C(TypeAttributes.Public)] private void f() { } [C(null, 123)] private void G() { } [C(B.B)] private void g() { } [C(123, 'C')] private void H() { } [C(new uint[]{123, 456})] private void h() { } private int B() { int i = 100; Console.WriteLine("tempLocalTest()"); int j = 10; return i; } } class C : Attribute { public string A; private int A; public int A() { return A; } public void A(int ) { A = ; } public C() { } public C(string , int ) { } public C(bool ) { } public C(string , string ) { } public C(string[] ) { } public C(Type , string ) { } public C(TypeAttributes , bool ) { } public C(b ) { } public C(B ) { } public C(ushort , char ) { } public C(object ) { } } public class c : Exception { internal string A = "This is a simple exception"; } class D : d { internal D(int ) { } internal D(int , int ) { } internal override void a() { Console.WriteLine("ChildClass.testLock() called"); base.a(); } internal void A() { } internal virtual void a() { } } enum b { A = 1, a = 2, B = 3, } [GuidAttribute("B5713A00-BEB3-11D5-81ED-00C04F2725D9")] [ComImportAttribute()] class a { } }