Is it possible to mark the .net function with the Obsolete attribute

I have created several WebRequest extension methods that support cancellation. Is it possible to mark related .net framework methods as deprecated? This will allow other developers to receive a warning and encourage them to use new extension methods.

+6
source share
3 answers

If you ask if you can mark methods from base class libraries with the Obsolete attribute (or any), the answer will be no. You must control the source for the methods that you want to tag with attributes.

+7
source

You might override the .Net Framework WebRequest class in the same assembly where the extension methods are defined in the System.Net namespace.

The new overridden WebRequest class can then extend the original System.Net.WebRequest class and override the existing corresponding method with the [Obsolete] tag.

+2
source

The "new #unt # C # directive" is an MVP wish list, not an actual function, but I think it is a topic that will provide some information about handling a planned crawl ... http://blog.tatham.oddie.com .au / 2010/06 /

0
source

Source: https://habr.com/ru/post/894513/


All Articles