Exemplo n.º 1
0
 public void Test05()
 {
     _03_Person tom = new _03_Person
     {
         Name    = "Tom",
         Age     = 9,
         Home    = { Town = "yoooo", Country = "CN" },
         Friends =
         {
             new  _03_Person {
                 Name = "A"
             },
             new _03_Person("B"),
             new _03_Person()
             {
                 Name = "Z", Age = 7
             },
             new _03_Person("F")
             {
                 Age  = 666,
                 Home =      { Country= "UK", Town = "ZZZZ" }
             }
         }
     };
 }
Exemplo n.º 2
0
        public void Test01()
        {
            _03_Person p1 = new _03_Person();

            p1.Name = "Tom";
            p1.Age  = 9;

            _03_Person p2 = new _03_Person("Tom");

            p2.Age = 9;


            _03_Person p3 = new _03_Person()
            {
                Name = "Tom", Age = 9
            };
            _03_Person p4 = new _03_Person {
                Name = "Tom", Age = 9
            };
            _03_Person p5 = new _03_Person {
                Age = 9, Name = "Tom",
            };
            _03_Person p6 = new _03_Person("Tom")
            {
                Age = 9
            };
        }
Exemplo n.º 3
0
        public void Test03()
        {
            _03_Person tom1 = new _03_Person("Tom");

            tom1.Age          = 9;
            tom1.Home.Country = "CN";
            tom1.Home.Town    = "Wulalalala";


            _03_Person tom2 = new _03_Person("Tom")
            {
                Age  = 9,
                Home = { Country = "CN", Town = "Wulalalala" }
            };
        }
Exemplo n.º 4
0
 public void Test02()
 {
     _03_Person[] family = new _03_Person[]
     {
         new _03_Person {
             Name = "Holly", Age = 9
         },
         new _03_Person {
             Name = "Jon", Age = 18
         },
         new _03_Person {
             Name = "Tom", Age = 27
         },
         new _03_Person {
             Name = "William", Age = 36
         },
         new _03_Person {
             Name = "Robin", Age = 45
         },
     };
 }