How to mark method as deprecated?

In computer software standards and documentation, the term deprecation is applied to software features that are superseded and should be avoided. Although deprecated features remain in the current version, their use may raise warning messages recommending alternate practices, and deprecation may indicate that the feature will be removed in the future. Features are deprecated—rather than being removed—in order to provide backward compatibility and give programmers using the feature time to bring their code into compliance with the new standard. You can mark your own methods as deprecated:

    [Obsolete("Use New Version with Textonly email version")]

    public DataTable GetReminderEmailsForToday() 

    { 

      .... 

    }


Posted on Monday, May 12, 2008 by | Comments (10) | Add Comment

Comments

Gravatar

Re:How to mark method as deprecated?

Very helpful. Thanks.

Posted on 8/19/2008 6:13:33 AM by Jim #
Gravatar

Re:How to mark method as deprecated?

Thanks!

Posted on 9/25/2008 12:58:12 PM by Carlos #
Gravatar

Re:How to mark method as deprecated?

thanks ,,its help a lot since im developing sdks

Posted on 2/17/2009 5:20:36 AM by Mudi_mora #
Gravatar

Re:How to mark method as deprecated?

If I mark an abstract method as deprecated, do I have to do this for all the places I override it ?

Posted on 8/20/2009 1:28:49 AM by dvd #
Gravatar

Yes, otherwise it will give you a warning only at place where you are overriding it.

Gravatar

Re:How to mark method as deprecated?

Thanks !

Posted on 3/22/2010 5:28:14 AM by haxpor #
Gravatar

Re:How to mark method as deprecated?

thanks

Posted on 6/2/2010 4:33:06 AM by sumit #
Gravatar

Re:How to mark method as deprecated?

There is an optional parameter which will cause it to throw a compile time error as well.

[Obsolete("This will throw a compile time exception.", true)]

Posted on 12/9/2011 9:59:03 AM by Chuck #
Gravatar

Re:How to mark method as deprecated?

I do this just rarely enough I can never remember what the tag is, so I still go back to this post everytime. Great reference post. Thanks!

Posted on 12/19/2011 8:19:13 AM by Tony #
Gravatar

Re: How to mark method as deprecated?

A Winner Is You!

Posted on 10/8/2012 5:15:07 AM by 80s Arcade #
Gravatar

Re: How to mark method as deprecated?

Thanks for the tip! Hard to find the post among all the ads, but helpful nonetheless!

Posted on 4/17/2013 12:35:17 PM by FlingDang #

New Comment

Your Name:
Email (for internal use only):
Comment:
 
Code above:

Categories

Recent Tweets

  • Simon Ince's Blog: Hierarchies with HierarchyID in SQL 2008 http://t.co/xSDwiF6rRS.
  • Visual Studio 2010 WAS painfully slow - CodeProject http://t.co/Usba1x6CZy

Valid HTML5