A personal repository of technical notes. - CSC

Make Property or Class Obsolete

Problem
Need to make class property obsolete so developers will not use it.

Solution
Set property to "obsolete" in code to cause a compile warning or error:
 [System.Obsolete("Deprecated: Don't use OldWay; use NewWay instead", true)]
public string Xxx
{
get
set
}
References
"Obsolete (C#)." MSDN: Microsoft Development, MSDN Subscriptions, Resources, and More. 18 Feb. 2009
http://msdn.microsoft.com/en-us/library/22kk2b44(VS.80).aspx.

No comments:

Post a Comment