The following C# code shows you how to use the Obsolete attribute to mark members and or types as obsolete. When a method has the Obsolete attribute, the C# compiler issues a warning if it is called. This helps keep programs correct. This makes it easier to transition from old methods.
[Obsolete("Use Dispose() instead")]
public void Close()
{
Dispose();
}