csharp Obsolete Attribute

/// <summary>
/// Example Method
/// </summary>
[Obsolete()]
public void MyMethod()
{
//basic use - throws a warning message during compilation
}

[Obsolete("This method is old, please use MyNewMethod()")]
public void MyMethod()
{
//warning message - use to specify a friendly warning message for a workaround
}

[Obsolete("This method is old, please use MyNewMethod()", true)]
public void MyMethod()
{
//error message - throws an error during compilation
}

//note: can also be used on classes and properties etc.
Demonstrates usage of Obsolete Attribute.

Updated: Wednesday 25th May 2011, 19:44pm

There are 0 comments

Leave a comment of your own

Comments are currently closed.