How do I mark a method as obsolete or deprecated using C#?
C# – How to mark a method as obsolete or deprecated
.netc++deprecatedversioning
Related Question
- C# – Deep cloning objects
- C# – How to enumerate an enum
- C# – How to use reflection to call a generic method
- C# – How to get a consistent byte representation of strings in C# without manually specifying an encoding
- Java – Why is Java Vector (and Stack) class considered obsolete or deprecated
- Homebrew install specific version of formula
- C# – How to make an HTTP POST web request
Best Solution
The shortest way is by adding the
ObsoleteAttribute
as an attribute to the method. Make sure to include an appropriate explanation:You can also cause the compilation to fail, treating the usage of the method as an error instead of warning, if the method is called from somewhere in code like this: