Obsolete or Deprecated?
How do you mark a class or method as deprecated/obsolete?
By using the Obsolete attribute
1 2 3 4 5 6 7 8 9 10 11 12 |
[Obsolete] public class Person { } [Obsolete("Class is obsolete, use PersonImpl")] public class Person { } //compilation to fail methods calling this code [Obsolete("Class is obsolete, use PersonImpl", true)] public class Person { } [Obsolete("Method is obsolete, use SomeMethod2", true)] public void SomeMethod() { } |
Leave A Comment