Example #1
0
 static void Main()
 {
     B.C c = new A.B.C();
     c.x = 1;
     A.B b = new A.B();
     b.i = 2;
 }
Example #2
0
    public static void Main(string[] args)
    {
        var b = new A.B();
        var c = new C();

        Console.WriteLine(b.getValue());
    }
Example #3
0
 static void Main()
 {
     global::A.B obj1 = new global::A.B();  //note the global keyword and it's usage.
     A.B         obj  = new A.B();
     Console.WriteLine(obj is A.B);
     LanguageBasics.A.B obj2 = new LanguageBasics.A.B();
     obj2.a = 20;
 }
Example #4
0
        static void Main(string[] args)
        {
            //.Console.WriteLine("Hello World!");
            var b = new A.B();

            Console.WriteLine(b.GetValue());
            // The example display the following output:
            // 10

            // Display info about SimpleClass
            Type         t     = typeof(SimpleClass);
            BindingFlags flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public |
                                 BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;

            MemberInfo[] members = t.GetMembers(flags);
            Console.WriteLine($"Type {t.Name} has {members.Length} members: ");
            foreach (var member in members)
            {
                string access = "";
                string stat   = "";
                var    method = member as MethodBase;
                if (method != null)
                {
                    if (method.IsPublic)
                    {
                        access = " Public";
                    }
                    else if (method.IsPrivate)
                    {
                        access = " Private";
                    }
                    else if (method.IsFamily)
                    {
                        access = " Protected";
                    }
                    else if (method.IsAssembly)
                    {
                        access = " Internal";
                    }
                    else if (method.IsFamilyOrAssembly)
                    {
                        access = "Protected Internal";
                    }
                    if (method.IsStatic)
                    {
                        stat = " Static";
                    }
                }
                var output = $"{member.Name} ({member.MemberType}): {access}{stat}, Declared by {member.DeclaringType}";
                Console.WriteLine(output);
            }

            // Test using ToString() method with SimpleClass
            SimpleClass sc = new SimpleClass();

            Console.WriteLine(sc.ToString());
            // Display output: SimpleClass
        }
Example #5
0
        static void Main(string[] args)
        {
            var a = new A();
            var b = new A.B();
            // var x = A.i;
            var y = A.j;
            var z = A.k;

            // var ww = A.w;
            Console.WriteLine("Hello World!");
        }
    public static void Main(string[] args)
    {
        var b = new A.B();
        var c = new A.C();

        Console.WriteLine(" FRASE NUMERO 1 :");
        Console.WriteLine(b.f());
        Console.WriteLine(" FRASE NUMERO 2 :");
        Console.WriteLine(c.fr2());
        Console.ReadKey();
    }
Example #7
0
    public static void Main()
    {
        A.B.M();

        var b = new A.B();

        b.X();

        var e = new C.D.E();

        e.Y();
    }
Example #8
0
        static void Main(string[] args)
        {
            //FunXingLei<int> i = new FunXingLei<int>();
            //i.Print(1);
            #region 泛型练习
            //FunXingLei<A> Aa = new FunXingLei<A>();
            //A a = new A();
            //Aa.Print(a);
            #endregion

            C   c1 = new C();
            A   a1 = new A();
            A.B b1 = new A.B();
            c1.c = a1.a + b1.b;
            Console.WriteLine(c1.c);

            Console.ReadKey();
        }
Example #9
0
 // since B is a nested class of A, it has no scope outside of A
 // outside of the definition of A, it must always be referred to as A.B
 public override int GetAnotherObject(A.B b)
 {
     return(15);
 }
Example #10
0
 static void Main(string[] args)
 {
     A.B test = new A.B();
     test.C();
 }
 public static int Foo(this A.B b)
 {
     return(b.Ib);
 }
    public C()
    {
        var objB = new A.B();

        X = objB.X;
    }
Example #13
0
 static void M2()
 {
     A.B b = new A.B(); // 可以访问 A.B
     b.i = 1;           // 可以访问 A.B 的 public 成员
 }
Example #14
0
 static void Main()
 {
     A.B x = A.B.D;
 }
Example #15
0
 public override int MethodA(A.B ab)
 {
     return(0);
 }
 void E()
 {
     var F = new A.B();        // ok!
     var G = new A.B.C();      // error!
 }
Example #17
0
 public static void Main()
 {
     object o = new A.B();
 }
 void Function1(A.B instanceOfB)
 {
     int x = instanceOfB.X; // get value of non-static field X
     int y = A.B.Y;         // get value of static field Y
 }
Example #19
0
	public static void Main()
	{
		object o = new A.B();
	}
 static void Main()
 {
     A.B b = new A.B();
 }