
[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);//新方法
}
}

本文详细解析了一个类中已过时方法的使用情况,并对比了新方法的实现方式,旨在帮助开发者理解如何在实践中应用这些方法,提高代码质量和效率。
1707

被折叠的 条评论
为什么被折叠?



