Tuesday, June 26, 2012

Deprecated in C#

I have been doing a lot of MVC3, Razor thing for a month. Last night, I needed to label a method to be deprecated (just like in java). I tried doing: [Deprecated] but it wasn't working.

After few minutes of googling, I figured out that the equivalent of Deprecated for C# is Obsolete, I discovered it was:
[Obsolete("Reason Why")] 
which is same to java, where in you have to annotate it either class, method or field.

No comments:

Post a Comment