[Serializable]//Attribute 特性
class Introduction
{
private String _name;//Field 字段
public String Name //Property 属性
{
get { return _name; }
set { _name = value; }
}
[Obsolete("此方法已经废弃,请调用新的替代方法DisplayNew(). 2011.7.31")]//Attribute 特性
public void Display()
{
Console.WriteLine(this._name);//某个已经过时的方法
}
public void DisplayNew()
{
Console.WriteLine("UserName = {0}", this._name);//新方法
}
}
基础知识备忘——字段(Field),属性(Property),特性(Attribute)
最新推荐文章于 2021-11-17 19:05:15 发布