C#3.0技术探讨(2):自动属性 Auto Property

/*--===------------------------------------------===---
自动属性: Auto Property
常规的属性的get,set不必书写了。

--===------------------------------------------===---
*/
namespace xumh
{
    
class student
    {
        
public string Name{get;set;}
        
public int Age{get;set;}
        
public string Address{get;set;}
    };

    
class runMyApp
    {
        
static void Main()
        {
            student s
=new student();
            s.Name
="许明会";
            s.Age
=36;
            s.Address
="北大青鸟";
            System.Console.WriteLine(
"{0},年龄{1},地址{2}.",
                s.Name,s.Age,s.Address);
        }
    };
}
原文地址:https://www.cnblogs.com/flaaash/p/981317.html