FieldInfo FieldInfo FieldInfo FieldInfo Class

定义

发现字段的属性并提供对字段元数据的访问权限。Discovers the attributes of a field and provides access to field metadata.

public ref class FieldInfo abstract : System::Reflection::MemberInfo, System::Runtime::InteropServices::_FieldInfo
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public abstract class FieldInfo : System.Reflection.MemberInfo, System.Runtime.InteropServices._FieldInfo
type FieldInfo = class
    inherit MemberInfo
    interface _FieldInfo
Public MustInherit Class FieldInfo
Inherits MemberInfo
Implements _FieldInfo
继承
派生
属性
实现

示例

下面的示例使用Type.GetFields方法以获取与字段相关的信息从FieldInfo类,然后显示字段特性。The following example uses the Type.GetFields method to get the field-related information from the FieldInfo class, and then displays field attributes.

using namespace System;
using namespace System::Reflection;
public ref class FieldInfoClass
{
public:
   int myField1;

protected:
   String^ myField2;
};

int main()
{
   array<FieldInfo^>^myFieldInfo;
   Type^ myType = FieldInfoClass::typeid;

   // Get the type and fields of FieldInfoClass.
   myFieldInfo = myType->GetFields( static_cast<BindingFlags>(BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::Public) );
   Console::WriteLine( "\nThe fields of FieldInfoClass are \n" );

   // Display the field information of FieldInfoClass.
   for ( int i = 0; i < myFieldInfo->Length; i++ )
   {
      Console::WriteLine( "\nName            : {0}", myFieldInfo[ i ]->Name );
      Console::WriteLine( "Declaring Type  : {0}", myFieldInfo[ i ]->DeclaringType );
      Console::WriteLine( "IsPublic        : {0}", myFieldInfo[ i ]->IsPublic );
      Console::WriteLine( "MemberType      : {0}", myFieldInfo[ i ]->MemberType );
      Console::WriteLine( "FieldType       : {0}", myFieldInfo[ i ]->FieldType );
      Console::WriteLine( "IsFamily        : {0}", myFieldInfo[ i ]->IsFamily );
   }
}
using System;
using System.Reflection;

public class FieldInfoClass
{
    public int myField1 = 0;
    protected string myField2 = null;
    public static void Main()
    {
        FieldInfo[] myFieldInfo;
        Type myType = typeof(FieldInfoClass);
        // Get the type and fields of FieldInfoClass.
        myFieldInfo = myType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance
            | BindingFlags.Public);
        Console.WriteLine("\nThe fields of " + 
            "FieldInfoClass are \n");
        // Display the field information of FieldInfoClass.
        for(int i = 0; i < myFieldInfo.Length; i++)
        {
            Console.WriteLine("\nName            : {0}", myFieldInfo[i].Name);
            Console.WriteLine("Declaring Type  : {0}", myFieldInfo[i].DeclaringType);
            Console.WriteLine("IsPublic        : {0}", myFieldInfo[i].IsPublic);
            Console.WriteLine("MemberType      : {0}", myFieldInfo[i].MemberType);
            Console.WriteLine("FieldType       : {0}", myFieldInfo[i].FieldType);
            Console.WriteLine("IsFamily        : {0}", myFieldInfo[i].IsFamily);
        }
    }
}
Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic

Public Class FieldInfoClass
    Public myField1 As Integer = 0
    Protected myField2 As String = Nothing

    Public Shared Sub Main()
        Dim myFieldInfo() As FieldInfo
        Dim myType As Type = GetType(FieldInfoClass)
        ' Get the type and fields of FieldInfoClass.
        myFieldInfo = myType.GetFields(BindingFlags.NonPublic Or _
                      BindingFlags.Instance Or BindingFlags.Public)
        Console.WriteLine(ControlChars.NewLine & "The fields of " & _
                      "FieldInfoClass class are " & ControlChars.NewLine)
        ' Display the field information of FieldInfoClass.
        Dim i As Integer
        For i = 0 To myFieldInfo.Length - 1
            Console.WriteLine(ControlChars.NewLine + "Name            : {0}", myFieldInfo(i).Name)
            Console.WriteLine("Declaring Type  : {0}", myFieldInfo(i).DeclaringType)
            Console.WriteLine("IsPublic        : {0}", myFieldInfo(i).IsPublic)
            Console.WriteLine("MemberType      : {0}", myFieldInfo(i).MemberType)
            Console.WriteLine("FieldType       : {0}", myFieldInfo(i).FieldType)
            Console.WriteLine("IsFamily        : {0}", myFieldInfo(i).IsFamily)
        Next i
    End Sub
End Class

注解

从元数据获取字段信息。The field information is obtained from metadata. FieldInfo类没有公共构造函数。The FieldInfo class does not have a public constructor. FieldInfo 对象获取通过调用GetFieldsGetField方法的Type对象。FieldInfo objects are obtained by calling either the GetFields or GetField method of a Type object.

字段是在类中定义的变量。Fields are variables defined in the class. FieldInfo 提供一个类中的字段的元数据的访问并为该字段提供动态设置和获取功能。FieldInfo provides access to the metadata for a field within a class and provides dynamic set and get functionality for the field. 类未加载到内存之前调用,或在对象上调用 get。The class is not loaded into memory until invoke or get is called on the object.

继承者说明

当从 FieldInfo 继承时,必须重写下面的成员:GetValue(Object)SetValue(Object, Object, BindingFlags, Binder, CultureInfo)When you inherit from FieldInfo, you must override the following members: GetValue(Object) and SetValue(Object, Object, BindingFlags, Binder, CultureInfo).

构造函数

FieldInfo() FieldInfo() FieldInfo() FieldInfo()

初始化 FieldInfo 类的新实例。Initializes a new instance of the FieldInfo class.

属性

Attributes Attributes Attributes Attributes

获取与此字段关联的特性。Gets the attributes associated with this field.

CustomAttributes CustomAttributes CustomAttributes CustomAttributes

获取包含此成员自定义属性的集合。Gets a collection that contains this member's custom attributes.

(Inherited from MemberInfo)
DeclaringType DeclaringType DeclaringType DeclaringType

获取声明该成员的类。Gets the class that declares this member.

(Inherited from MemberInfo)
FieldHandle FieldHandle FieldHandle FieldHandle

获取 RuntimeFieldHandle,它是字段的内部元数据表示形式的句柄。Gets a RuntimeFieldHandle, which is a handle to the internal metadata representation of a field.

FieldType FieldType FieldType FieldType

获取此字段对象的类型。Gets the type of this field object.

IsAssembly IsAssembly IsAssembly IsAssembly

获取一个值,该值指示此字段的潜在可见性是否由 Assembly 描述;也就是说,此字段只对同一程序集中的其他类型可见,而对该程序集以外的派生类型则不可见。Gets a value indicating whether the potential visibility of this field is described by Assembly; that is, the field is visible at most to other types in the same assembly, and is not visible to derived types outside the assembly.

IsCollectible IsCollectible IsCollectible IsCollectible

获取一个值,该值指示此 MemberInfo 对象是否是包含在可回收的 AssemblyLoadContext 中的程序集的一部分。Gets a value that indicates whether this MemberInfo object is part of an assembly held in a collectible AssemblyLoadContext.

(Inherited from MemberInfo)
IsFamily IsFamily IsFamily IsFamily

获取一个值,该值指示此字段的可见性是否由 Family 描述;也就是说,此字段仅在其类和派生类内可见。Gets a value indicating whether the visibility of this field is described by Family; that is, the field is visible only within its class and derived classes.

IsFamilyAndAssembly IsFamilyAndAssembly IsFamilyAndAssembly IsFamilyAndAssembly

获取一个值,该值指示此字段的可见性是否由 FamANDAssem 描述;也就是说,可从派生类访问此字段,但仅当这些派生类在同一程序集中时。Gets a value indicating whether the visibility of this field is described by FamANDAssem; that is, the field can be accessed from derived classes, but only if they are in the same assembly.

IsFamilyOrAssembly IsFamilyOrAssembly IsFamilyOrAssembly IsFamilyOrAssembly

获取一个值,该值指示此字段的潜在可见性是否由 FamORAssem 描述;也就是说,可通过派生类(无论其位置如何)和同一程序集中的类访问此字段。Gets a value indicating whether the potential visibility of this field is described by FamORAssem; that is, the field can be accessed by derived classes wherever they are, and by classes in the same assembly.

IsInitOnly IsInitOnly IsInitOnly IsInitOnly

获取一个值,通过该值指示此字段是否只能在构造函数的主体中设置。Gets a value indicating whether the field can only be set in the body of the constructor.

IsLiteral IsLiteral IsLiteral IsLiteral

获取一个值,通过该值指示该值是否在编译时写入并且不能更改。Gets a value indicating whether the value is written at compile time and cannot be changed.

IsNotSerialized IsNotSerialized IsNotSerialized IsNotSerialized

获取一个值,通过该值指示此字段是否有 NotSerialized 特性。Gets a value indicating whether this field has the NotSerialized attribute.

IsPinvokeImpl IsPinvokeImpl IsPinvokeImpl IsPinvokeImpl

获取一个值,该值指示是否已在 FieldAttributes 中设置相应的 PinvokeImpl 特性。Gets a value indicating whether the corresponding PinvokeImpl attribute is set in FieldAttributes.

IsPrivate IsPrivate IsPrivate IsPrivate

获取一个值,通过该值指示此字段是否为私有字段。Gets a value indicating whether the field is private.

IsPublic IsPublic IsPublic IsPublic

获取一个值,通过该值指示此字段是否为公共字段。Gets a value indicating whether the field is public.

IsSecurityCritical IsSecurityCritical IsSecurityCritical IsSecurityCritical

获取一个值,该值指示当前字段在当前信任级别上是安全关键的还是安全可靠关键的。Gets a value that indicates whether the current field is security-critical or security-safe-critical at the current trust level.

IsSecuritySafeCritical IsSecuritySafeCritical IsSecuritySafeCritical IsSecuritySafeCritical

获取一个值,该值指示当前字段在当前信任级别上是否是安全可靠关键的。Gets a value that indicates whether the current field is security-safe-critical at the current trust level.

IsSecurityTransparent IsSecurityTransparent IsSecurityTransparent IsSecurityTransparent

获取一个值,该值指示当前字段在当前信任级别上是否是透明的。Gets a value that indicates whether the current field is transparent at the current trust level.

IsSpecialName IsSpecialName IsSpecialName IsSpecialName

获取一个值,该值指示是否已在 FieldAttributes 枚举数中设置相应的 SpecialName 特性。Gets a value indicating whether the corresponding SpecialName attribute is set in the FieldAttributes enumerator.

IsStatic IsStatic IsStatic IsStatic

获取一个值,通过该值指示此字段是否为静态字段。Gets a value indicating whether the field is static.

MemberType MemberType MemberType MemberType

获取 MemberTypes 值,该值指示此成员是字段。Gets a MemberTypes value indicating that this member is a field.

MetadataToken MetadataToken MetadataToken MetadataToken

获取一个值,该值标识元数据元素。Gets a value that identifies a metadata element.

(Inherited from MemberInfo)
Module Module Module Module

获取一个模块,在该模块中已经定义一个类型,该类型用于声明由当前 MemberInfo 表示的成员。Gets the module in which the type that declares the member represented by the current MemberInfo is defined.

(Inherited from MemberInfo)
Name Name Name Name

获取当前成员的名称。Gets the name of the current member.

(Inherited from MemberInfo)
ReflectedType ReflectedType ReflectedType ReflectedType

获取用于获取 MemberInfo 的此实例的类对象。Gets the class object that was used to obtain this instance of MemberInfo.

(Inherited from MemberInfo)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

返回一个值,该值指示此实例是否与指定的对象相等。Returns a value that indicates whether this instance is equal to a specified object.

GetCustomAttributes(Boolean) GetCustomAttributes(Boolean) GetCustomAttributes(Boolean) GetCustomAttributes(Boolean)

在派生类中重写时,返回应用于此成员的所有自定义属性的数组。When overridden in a derived class, returns an array of all custom attributes applied to this member.

(Inherited from MemberInfo)
GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean)

在派生类中重写时,返回应用于此成员并由 Type 标识的自定义属性的数组。When overridden in a derived class, returns an array of custom attributes applied to this member and identified by Type.

(Inherited from MemberInfo)
GetCustomAttributesData() GetCustomAttributesData() GetCustomAttributesData() GetCustomAttributesData()

返回 CustomAttributeData 对象列表,这些对象表示已应用到目标成员的特性相关数据。Returns a list of CustomAttributeData objects representing data about the attributes that have been applied to the target member.

(Inherited from MemberInfo)
GetFieldFromHandle(RuntimeFieldHandle) GetFieldFromHandle(RuntimeFieldHandle) GetFieldFromHandle(RuntimeFieldHandle) GetFieldFromHandle(RuntimeFieldHandle)

获取由指定句柄表示的字段的 FieldInfoGets a FieldInfo for the field represented by the specified handle.

GetFieldFromHandle(RuntimeFieldHandle, RuntimeTypeHandle) GetFieldFromHandle(RuntimeFieldHandle, RuntimeTypeHandle) GetFieldFromHandle(RuntimeFieldHandle, RuntimeTypeHandle) GetFieldFromHandle(RuntimeFieldHandle, RuntimeTypeHandle)

获取由指定句柄表示的指定泛型类型字段的 FieldInfoGets a FieldInfo for the field represented by the specified handle, for the specified generic type.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

GetOptionalCustomModifiers() GetOptionalCustomModifiers() GetOptionalCustomModifiers() GetOptionalCustomModifiers()

获取一个类型数组,这些类型标识字段的可选自定义修饰符。Gets an array of types that identify the optional custom modifiers of the field.

GetRawConstantValue() GetRawConstantValue() GetRawConstantValue() GetRawConstantValue()

由编译器返回与字段关联的文本值。Returns a literal value associated with the field by a compiler.

GetRequiredCustomModifiers() GetRequiredCustomModifiers() GetRequiredCustomModifiers() GetRequiredCustomModifiers()

获取一个类型数组,这些类型标识属性所需的自定义修饰符。Gets an array of types that identify the required custom modifiers of the property.

GetType() GetType() GetType() GetType()
GetValue(Object) GetValue(Object) GetValue(Object) GetValue(Object)

当在派生类中重写时,返回给定对象支持的字段的值。When overridden in a derived class, returns the value of a field supported by a given object.

GetValueDirect(TypedReference) GetValueDirect(TypedReference) GetValueDirect(TypedReference) GetValueDirect(TypedReference)

返回给定对象所支持的字段的值。Returns the value of a field supported by a given object.

HasSameMetadataDefinitionAs(MemberInfo) HasSameMetadataDefinitionAs(MemberInfo) HasSameMetadataDefinitionAs(MemberInfo) HasSameMetadataDefinitionAs(MemberInfo) Inherited from MemberInfo
IsDefined(Type, Boolean) IsDefined(Type, Boolean) IsDefined(Type, Boolean) IsDefined(Type, Boolean)

在派生类中重写时,指示是否将指定类型或其派生类型的一个或多个特性应用于此成员。When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member.

(Inherited from MemberInfo)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
SetValue(Object, Object) SetValue(Object, Object) SetValue(Object, Object) SetValue(Object, Object)

设置给定对象支持的字段的值。Sets the value of the field supported by the given object.

SetValue(Object, Object, BindingFlags, Binder, CultureInfo) SetValue(Object, Object, BindingFlags, Binder, CultureInfo) SetValue(Object, Object, BindingFlags, Binder, CultureInfo) SetValue(Object, Object, BindingFlags, Binder, CultureInfo)

在派生类中被重写时,设置给定对象支持的字段的值。When overridden in a derived class, sets the value of the field supported by the given object.

SetValueDirect(TypedReference, Object) SetValueDirect(TypedReference, Object) SetValueDirect(TypedReference, Object) SetValueDirect(TypedReference, Object)

设置给定对象支持的字段的值。Sets the value of the field supported by the given object.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

操作员

Equality(FieldInfo, FieldInfo) Equality(FieldInfo, FieldInfo) Equality(FieldInfo, FieldInfo) Equality(FieldInfo, FieldInfo)

指示两个 FieldInfo 对象是否相等。Indicates whether two FieldInfo objects are equal.

Inequality(FieldInfo, FieldInfo) Inequality(FieldInfo, FieldInfo) Inequality(FieldInfo, FieldInfo) Inequality(FieldInfo, FieldInfo)

指示两个 FieldInfo 对象是否不相等。Indicates whether two FieldInfo objects are not equal.

显式界面实现

ICustomAttributeProvider.GetCustomAttributes(Boolean) ICustomAttributeProvider.GetCustomAttributes(Boolean) ICustomAttributeProvider.GetCustomAttributes(Boolean) ICustomAttributeProvider.GetCustomAttributes(Boolean) Inherited from MemberInfo
ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) Inherited from MemberInfo
ICustomAttributeProvider.IsDefined(Type, Boolean) ICustomAttributeProvider.IsDefined(Type, Boolean) ICustomAttributeProvider.IsDefined(Type, Boolean) ICustomAttributeProvider.IsDefined(Type, Boolean) Inherited from MemberInfo
_FieldInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _FieldInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _FieldInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _FieldInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。Maps a set of names to a corresponding set of dispatch identifiers.

_FieldInfo.GetType() _FieldInfo.GetType() _FieldInfo.GetType() _FieldInfo.GetType()

获取表示 Type 类型的 FieldInfo 对象。Gets a Type object representing the FieldInfo type.

_FieldInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _FieldInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _FieldInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _FieldInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。Retrieves the type information for an object, which can then be used to get the type information for an interface.

_FieldInfo.GetTypeInfoCount(UInt32) _FieldInfo.GetTypeInfoCount(UInt32) _FieldInfo.GetTypeInfoCount(UInt32) _FieldInfo.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

_FieldInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _FieldInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _FieldInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _FieldInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。Provides access to properties and methods exposed by an object.

_MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from MemberInfo)
_MemberInfo.GetType() _MemberInfo.GetType() _MemberInfo.GetType() _MemberInfo.GetType()

获取一个表示 MemberInfo 类的 Type 对象。Gets a Type object representing the MemberInfo class.

(Inherited from MemberInfo)
_MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。Retrieves the type information for an object, which can then be used to get the type information for an interface.

(Inherited from MemberInfo)
_MemberInfo.GetTypeInfoCount(UInt32) _MemberInfo.GetTypeInfoCount(UInt32) _MemberInfo.GetTypeInfoCount(UInt32) _MemberInfo.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from MemberInfo)
_MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。Provides access to properties and methods exposed by an object.

(Inherited from MemberInfo)

Extension Methods

GetCustomAttribute(MemberInfo, Type) GetCustomAttribute(MemberInfo, Type) GetCustomAttribute(MemberInfo, Type) GetCustomAttribute(MemberInfo, Type)

检索应用于指定成员的指定类型的自定义特性。Retrieves a custom attribute of a specified type that is applied to a specified member.

GetCustomAttribute(MemberInfo, Type, Boolean) GetCustomAttribute(MemberInfo, Type, Boolean) GetCustomAttribute(MemberInfo, Type, Boolean) GetCustomAttribute(MemberInfo, Type, Boolean)

检索应用于指定成员的指定类型的自定义特性,并可选择检查该成员的上级。Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttribute<T>(MemberInfo) GetCustomAttribute<T>(MemberInfo) GetCustomAttribute<T>(MemberInfo) GetCustomAttribute<T>(MemberInfo)

检索应用于指定成员的指定类型的自定义特性。Retrieves a custom attribute of a specified type that is applied to a specified member.

GetCustomAttribute<T>(MemberInfo, Boolean) GetCustomAttribute<T>(MemberInfo, Boolean) GetCustomAttribute<T>(MemberInfo, Boolean) GetCustomAttribute<T>(MemberInfo, Boolean)

检索应用于指定成员的指定类型的自定义特性,并可选择检查该成员的上级。Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes(MemberInfo) GetCustomAttributes(MemberInfo) GetCustomAttributes(MemberInfo) GetCustomAttributes(MemberInfo)

检索应用于指定成员的自定义特性集合。Retrieves a collection of custom attributes that are applied to a specified member.

GetCustomAttributes(MemberInfo, Boolean) GetCustomAttributes(MemberInfo, Boolean) GetCustomAttributes(MemberInfo, Boolean) GetCustomAttributes(MemberInfo, Boolean)

检索应用于指定成员的自定义特性集合,并可选择检查该成员的上级。Retrieves a collection of custom attributes that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes(MemberInfo, Type) GetCustomAttributes(MemberInfo, Type) GetCustomAttributes(MemberInfo, Type) GetCustomAttributes(MemberInfo, Type)

检索应用于指定成员的指定类型的自定义特性集合。Retrieves a collection of custom attributes of a specified type that are applied to a specified member.

GetCustomAttributes(MemberInfo, Type, Boolean) GetCustomAttributes(MemberInfo, Type, Boolean) GetCustomAttributes(MemberInfo, Type, Boolean) GetCustomAttributes(MemberInfo, Type, Boolean)

检索应用于指定成员的指定类型的自定义特性集合,并可选择检查该成员的上级。Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes<T>(MemberInfo) GetCustomAttributes<T>(MemberInfo) GetCustomAttributes<T>(MemberInfo) GetCustomAttributes<T>(MemberInfo)

检索应用于指定成员的指定类型的自定义特性集合。Retrieves a collection of custom attributes of a specified type that are applied to a specified member.

GetCustomAttributes<T>(MemberInfo, Boolean) GetCustomAttributes<T>(MemberInfo, Boolean) GetCustomAttributes<T>(MemberInfo, Boolean) GetCustomAttributes<T>(MemberInfo, Boolean)

检索应用于指定成员的指定类型的自定义特性集合,并可选择检查该成员的上级。Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member.

IsDefined(MemberInfo, Type) IsDefined(MemberInfo, Type) IsDefined(MemberInfo, Type) IsDefined(MemberInfo, Type)

确定是否将指定类型的任何自定义属性应用于指定的成员。Indicates whether custom attributes of a specified type are applied to a specified member.

IsDefined(MemberInfo, Type, Boolean) IsDefined(MemberInfo, Type, Boolean) IsDefined(MemberInfo, Type, Boolean) IsDefined(MemberInfo, Type, Boolean)

指示一个指定类型的自定义特性是否应用于一个指定的数字,并选择性地应用于其的上级。Indicates whether custom attributes of a specified type are applied to a specified member, and, optionally, applied to its ancestors.

GetMetadataToken(MemberInfo) GetMetadataToken(MemberInfo) GetMetadataToken(MemberInfo) GetMetadataToken(MemberInfo)
HasMetadataToken(MemberInfo) HasMetadataToken(MemberInfo) HasMetadataToken(MemberInfo) HasMetadataToken(MemberInfo)

安全性

InheritanceDemand
继承者完全信任。for full trust for inheritors. 不能由部分受信任代码继承此类。This class cannot be inherited by partially trusted code.

适用于

线程安全性

此类型是线程安全的。This type is thread safe.

另请参阅