In this C# program, we are creating two static methods methodA and methodB to use obsolete class. Hence the obsolete attribute generates a compile-time warning. When a method has the obsolete attribute, the C# compiler issues a warning if it is called.

advertisement

Runtime Test Cases

MethodA shows an Warning when called and MethodB is not an Obsolete Method