If I want to declare a method in my code as deprecated / obsolete, I can add the [Obsolete]
attribute to it and make the compiler emit a warning (or error) whenever the method is used.
Is it possible to achieve a similar effect for third-party methods (such as System.Console.WriteLine
)? Obviously, I cannot add the attribute since I do not control the code. But maybe there is some other trick available in .NET or Visual Studio?
I'm preferably looking for an "out of the box" solution that does not require something like writing my own post-build script that manually parses the code.