using System;
class MainClass
{
[Obsolete("Method1 has been replaced by NewMethod1", false)]
public static int Method1()
{
return 1;
}
public static void Main()
{
Console.WriteLine(Method1());
}
}
Output
ObsoleteattributewarntheuserthatMethodisobsolete.cs(18,21): warning CS0618: 'MainClass.Method1()' is
obsolete: 'Method1 has been replaced by NewMethod1'
1