C# (Sharp) Programming Language Question:

How do you mark a method obsolete?

Tweet Share WhatsApp

Answer:

[Obsolete] public int Foo() {...}
or
[Obsolete("This is a message describing why this method is obsolete")] public int Foo() {...}
Note: The O in Obsolete is always capitalized.

Download C# (Sharp) Programming Language PDF Read All 163 C# (Sharp) Programming Language Questions
Previous QuestionNext Question
How do you specify a custom attribute for the entire assembly (rather than for a class)? How do you implement thread synchronization (Object.Wait, Notify,and CriticalSection) in C#?