CSharp examples for Custom Type:Attribute
An attribute is defined by a class that inherits from the abstract class System.Attribute.
To attach an attribute to a code element, specify the attribute's type name in square brackets, before the code element.
The following attaches the ObsoleteAttribute to the Foo class:
[ObsoleteAttribute] public class Foo {...}
C# allows you to omit the suffix when attaching an attribute:
[Obsolete] public class Foo {...}
ObsoleteAttribute is a type declared in the System namespace:
public sealed class ObsoleteAttribute : Attribute {...}