ExtensionAttribute
Class
Definition
Indicates that a method is an extension method, or that a class or assembly contains extension methods.
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method)]
public sealed class ExtensionAttribute : Attribute
- Inheritance
- Attributes
Inherited Members
System.Attribute
System.Object
Remarks
In Visual Basic, you should use this attribute to create an extension method. For more information, see Extension Methods.
In C#, you do not need to use this attribute; you should use the this modifier for the first parameter to create an extension method. The compiler automatically emits ExtensionAttribute for extension methods. For more information, see Extension Methods.
If you are writing a compiler that supports extension methods, your compiler should emit this attribute on each extension method and on each class and assembly that contains one or more extension methods.
Constructors
| ExtensionAttribute() |
Initializes a new instance of the ExtensionAttribute class. |