Click to Rate and Give Feedback
.NET Framework Class Library
ExtensionAttribute Class

Updated: November 2007

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Indicates that a method is an extension method, or that a class or assembly contains extension methods.

Namespace:  System.Runtime.CompilerServices
Assembly:  System.Core (in System.Core.dll)

Visual Basic (Declaration)
<AttributeUsageAttribute(AttributeTargets.Assembly Or AttributeTargets.Class Or AttributeTargets.Method)> _
Public NotInheritable Class ExtensionAttribute _
    Inherits Attribute
Visual Basic (Usage)
Dim instance As ExtensionAttribute
C#
[AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method)]
public sealed class ExtensionAttribute : Attribute
Visual C++
[AttributeUsageAttribute(AttributeTargets::Assembly|AttributeTargets::Class|AttributeTargets::Method)]
public ref class ExtensionAttribute sealed : public Attribute
J#
/** @attribute AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method) */
public final class ExtensionAttribute extends Attribute
JScript
public final class ExtensionAttribute extends Attribute

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.

System..::.Object
  System..::.Attribute
    System.Runtime.CompilerServices..::.ExtensionAttribute
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows Vista, Windows XP SP2, Windows Server 2003, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5

.NET Compact Framework

Supported in: 3.5
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker