Share via


DefaultMemberAttribute Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Defines the member of a type that is the default member used by InvokeMember.

Inheritance Hierarchy

System. . :: . .Object
  System. . :: . .Attribute
    System.Reflection..::..DefaultMemberAttribute

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SerializableAttribute> _
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Interface)> _
Public NotInheritable Class DefaultMemberAttribute _
    Inherits Attribute
[SerializableAttribute]
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Interface)]
public sealed class DefaultMemberAttribute : Attribute
[SerializableAttribute]
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Interface)]
public ref class DefaultMemberAttribute sealed : public Attribute
[<Sealed>]
[<SerializableAttribute>]
[<AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Interface)>]
type DefaultMemberAttribute =  
    class
        inherit Attribute
    end
public final class DefaultMemberAttribute extends Attribute

The DefaultMemberAttribute type exposes the following members.

Constructors

  Name Description
Public method DefaultMemberAttribute Initializes a new instance of the DefaultMemberAttribute class.

Top

Properties

  Name Description
Public property MemberName Gets the name from the attribute.

Top

Methods

  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

A property is imported as an indexer (default indexed property in Visual Basic) if the property has arguments and if the name of the property or one of its accessors matches the name specified by the DefaultMemberAttribute. If the DefaultMemberAttribute is not present on the containing type, then the type does not have an indexer. The C# compiler emits the DefaultMemberAttribute on any type containing an indexer. In C# it is an error to manually attribute a type with the DefaultMemberAttribute if the type also declares an indexer.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Reflection Namespace