C#基础知识之this关键字

时间:2016-04-16 22:55:56   收藏:0   阅读:292

this关键字

        public class Person
        {
            public string Name { get; set; }
            public int Age { get; set; }
            public Person(string Name, int Age)
            {
                this.Age = Age;
                this.Name = Name;
            }
        }
        public class Person
        {
            public string Name { get; set; }
            public int Age { get; set; }
            public Person(string Name, int Age)
            {
                this.Age = Age;
                this.Name = Name;
            }
            public void CallTest(Person person)
            {
                Console.WriteLine(person.Name + person.Age);
            }
            public void Call()
            {
                CallTest(this);
            }
        }
        public class Person
        {
            string[] PersonList = new string[10];
            public string this[int param]
            {
                get { return PersonList[param]; }
                set { PersonList[param] = value; }
            }
        }

原文:http://www.cnblogs.com/liujie2272/p/5399603.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!