EventInfo EventInfo EventInfo EventInfo Class

定義

探索事件的屬性 (Attribute) 並提供事件中繼資料 (Metadata) 的存取。Discovers the attributes of an event and provides access to event metadata.

public ref class EventInfo abstract : System::Reflection::MemberInfo, System::Runtime::InteropServices::_EventInfo
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public abstract class EventInfo : System.Reflection.MemberInfo, System.Runtime.InteropServices._EventInfo
type EventInfo = class
    inherit MemberInfo
    interface _EventInfo
Public MustInherit Class EventInfo
Inherits MemberInfo
Implements _EventInfo
繼承
衍生
屬性
實作

範例

下列程式碼會取得EventInfo物件Click事件的Button類別。The following code gets an EventInfo object for the Click event of the Button class.

#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>

using namespace System;
using namespace System::Reflection;
using namespace System::Security;
using namespace System::Windows::Forms;

int main()
{
   try
   {
      // Creates a bitmask based on BindingFlags.
      BindingFlags myBindingFlags = static_cast<BindingFlags>(BindingFlags::Instance | BindingFlags::Public | BindingFlags::NonPublic);
      Type^ myTypeBindingFlags = System::Windows::Forms::Button::typeid;
      EventInfo^ myEventBindingFlags = myTypeBindingFlags->GetEvent( "Click", myBindingFlags );
      if ( myEventBindingFlags != nullptr )
      {
         Console::WriteLine( "Looking for the Click event in the Button class with the specified BindingFlags." );
         Console::WriteLine( myEventBindingFlags );
      }
      else
            Console::WriteLine( "The Click event is not available with the Button class." );
   }
   catch ( SecurityException^ e ) 
   {
      Console::WriteLine( "An exception occurred." );
      Console::WriteLine( "Message : {0}", e->Message );
   }
   catch ( ArgumentNullException^ e ) 
   {
      Console::WriteLine( "An exception occurred." );
      Console::WriteLine( "Message : {0}", e->Message );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "The following exception was raised : {0}", e->Message );
   }
}
using System;
using System.Reflection;
using System.Security;

class MyEventExample
{
    public static void Main()
    {  
        try
        {

            // Creates a bitmask based on BindingFlags.
            BindingFlags myBindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
            Type myTypeBindingFlags = typeof(System.Windows.Forms.Button);
            EventInfo myEventBindingFlags = myTypeBindingFlags.GetEvent("Click", myBindingFlags);
            if(myEventBindingFlags != null)
            {
                Console.WriteLine("Looking for the Click event in the Button class with the specified BindingFlags.");
                Console.WriteLine(myEventBindingFlags.ToString());
            }
            else
                Console.WriteLine("The Click event is not available with the Button class.");
        }
        catch(SecurityException e)
        {
            Console.WriteLine("An exception occurred.");
            Console.WriteLine("Message :"+e.Message);
        }
        catch(ArgumentNullException e)
        {
            Console.WriteLine("An exception occurred.");
            Console.WriteLine("Message :"+e.Message);
        }
        catch(Exception e)
        {
            Console.WriteLine("The following exception was raised : {0}",e.Message);
        }
    }
}
Imports System
Imports System.Reflection
Imports System.Security
Imports Microsoft.VisualBasic

' Compile this sample using the following command line:
' vbc type_getevent.vb /r:"System.Windows.Forms.dll" /r:"System.dll"

Class MyEventExample
    Public Shared Sub Main()
        Try
            ' Creates a bitmask comprising  BindingFlags.
            Dim myBindingFlags As BindingFlags = BindingFlags.Instance Or BindingFlags.Public _
                                                 Or BindingFlags.NonPublic
            Dim myTypeBindingFlags As Type = GetType(System.Windows.Forms.Button)
            Dim myEventBindingFlags As EventInfo = myTypeBindingFlags.GetEvent("Click", myBindingFlags)
            If myEventBindingFlags IsNot Nothing Then
                Console.WriteLine("Looking for the Click event in the Button class with the specified BindingFlags.")
                Console.WriteLine(myEventBindingFlags.ToString())
            Else
                Console.WriteLine("The Click event is not available with the Button class.")
            End If
        Catch e As SecurityException
            Console.WriteLine("An exception occurred.")
            Console.WriteLine("Message :" + e.Message)
        Catch e As ArgumentNullException
            Console.WriteLine("An exception occurred.")
            Console.WriteLine("Message :" + e.Message)
        Catch e As Exception
            Console.WriteLine("The following exception was raised : {0}", e.Message)
        End Try
    End Sub 'Main
End Class 'MyEventExample

備註

使用EventInfo類別檢查事件,並連結事件處理常式,如中的範例程式碼所示AddEventHandler方法。Use the EventInfo class to inspect events and to hook up event handlers, as shown in the example code for the AddEventHandler method.

注意

EventInfo 不是用來引發事件。EventInfo is not intended to be used to raise events. 物件會引發事件,即會依照其內部狀態。An object raises events as dictated by its internal state.

事件可使用委派。Events are used with delegates. 事件接聽程式具現化時引發事件的事件來源叫用事件處理常式委派。An event listener instantiates an event-handler delegate that is invoked whenever the event is raised by an event source. 若要連接至事件來源,事件接聽程式會將這個委派加入至來源的引動過程清單。In order to connect to the event source, the event listener adds this delegate to the invocation list on the source. 當引發事件時,會呼叫事件處理常式委派的叫用方法。When the event is raised, the invoke method of the event-handler delegate is called. 支援兩個多點傳送與單點傳送事件通知。Both multicast and single-cast event notifications are supported. AddRemove中繼資料中,則必須標示方法,以及與事件相關聯的事件處理常式委派類別。The Add and Remove methods, as well as the event-handler delegate class associated with an event, must be marked in the metadata.

委派是物件導向的函式指標。Delegates are object-oriented function pointers. 在 C 或 c + + 中,函式指標是一種方法的參考。In C or C++, a function pointer is a reference to a method. 相較於 C 或 c + + 函式指標,委派會包含兩個參考︰ 方法和支援方法的物件參考的參考。In contrast to the C or C++ function pointer, a delegate contains two references: a reference to a method and a reference to an object that supports the method. 委派可以叫用方法,而不需要知道類別類型宣告或繼承的方法。Delegates can invoke a method without knowing the class type that declares or inherits the method. 委派只需要知道方法的傳回型別和參數清單。Delegates need only know the return type and parameter list of the method.

事件模型同樣適用於單點傳送和多點傳送委派。The event model works equally well for single-cast and multicast delegates. 委派的叫用時呼叫方法時,只有單一物件會有在其上呼叫的方法。When the delegate's invoke method is called, only a single object will have a method called on it. 多點傳送的修飾詞可以套用至委派的宣告,可讓多個呼叫委派的叫用方法時要呼叫的方法。A multicast modifier can be applied to a delegate declaration, which allows multiple methods to be called when the invoke method of the delegate is called.

呼叫ICustomAttributeProvider.GetCustomAttributesEventInfoinherit參數GetCustomAttributestrue不要走的型別階層。Calling ICustomAttributeProvider.GetCustomAttributes on EventInfo when the inherit parameter of GetCustomAttributes is true does not walk the type hierarchy. 使用System.Attribute繼承自訂屬性。Use System.Attribute to inherit custom attributes.

給繼承者的注意事項

當您繼承自EventInfo,您必須覆寫下列成員: GetAddMethod(Boolean)GetRemoveMethod(Boolean),和GetRaiseMethod(Boolean)When you inherit from EventInfo, you must override the following members: GetAddMethod(Boolean), GetRemoveMethod(Boolean), and GetRaiseMethod(Boolean).

建構函式

EventInfo() EventInfo() EventInfo() EventInfo()

初始化 EventInfo 類別的新執行個體。Initializes a new instance of the EventInfo class.

屬性

AddMethod AddMethod AddMethod AddMethod

取得事件之 MethodInfo 方法 (包括非公用方法) 的 AddEventHandler(Object, Delegate) 物件。Gets the MethodInfo object for the AddEventHandler(Object, Delegate) method of the event, including non-public methods.

Attributes Attributes Attributes Attributes

取得這個事件的屬性。Gets the attributes for this event.

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)
EventHandlerType EventHandlerType EventHandlerType EventHandlerType

取得與這個事件相關之目前的事件處理常式委派之 Type 物件。Gets the Type object of the underlying event-handler delegate associated with this event.

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)
IsMulticast IsMulticast IsMulticast IsMulticast

取得值,指出事件是否為多點傳送。Gets a value indicating whether the event is multicast.

IsSpecialName IsSpecialName IsSpecialName IsSpecialName

取得值,指出 EventInfo 是否具有特殊意義的名稱。Gets a value indicating whether the EventInfo has a name with a special meaning.

MemberType MemberType MemberType MemberType

取得 MemberTypes 值,表示這個成員為事件。Gets a MemberTypes value indicating that this member is an event.

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)
RaiseMethod RaiseMethod RaiseMethod RaiseMethod

取得引發事件時所呼叫的方法,包括非公用方法。Gets the method that is called when the event is raised, including non-public methods.

ReflectedType ReflectedType ReflectedType ReflectedType

取得類別物件,是用來取得這個 MemberInfo 的執行個體。Gets the class object that was used to obtain this instance of MemberInfo.

(Inherited from MemberInfo)
RemoveMethod RemoveMethod RemoveMethod RemoveMethod

取得用來移除事件方法 (包括非公用方法) 的 MethodInfo 物件。Gets the MethodInfo object for removing a method of the event, including non-public methods.

方法

AddEventHandler(Object, Delegate) AddEventHandler(Object, Delegate) AddEventHandler(Object, Delegate) AddEventHandler(Object, Delegate)

將事件處理常式加入至事件來源。Adds an event handler to an event source.

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

傳回值,這個值指出此執行個體是否與指定的物件相等。Returns a value that indicates whether this instance is equal to a specified object.

GetAddMethod() GetAddMethod() GetAddMethod() GetAddMethod()

傳回用來將事件處理常式委派加入至事件來源的方法。Returns the method used to add an event handler delegate to the event source.

GetAddMethod(Boolean) GetAddMethod(Boolean) GetAddMethod(Boolean) GetAddMethod(Boolean)

在衍生類別中覆寫時,針對事件的 AddEventHandler(Object, Delegate) 方法擷取 MethodInfo 物件,指定是否要傳回非公用方法。When overridden in a derived class, retrieves the MethodInfo object for the AddEventHandler(Object, Delegate) method of the event, specifying whether to return non-public methods.

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)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

傳回這個執行個體的雜湊碼。Returns the hash code for this instance.

GetOtherMethods() GetOtherMethods() GetOtherMethods() GetOtherMethods()

傳回使用 .other 指示詞與中繼資料中的事件產生關聯的公用方法。Returns the public methods that have been associated with an event in metadata using the .other directive.

GetOtherMethods(Boolean) GetOtherMethods(Boolean) GetOtherMethods(Boolean) GetOtherMethods(Boolean)

傳回使用 .other 指示詞與中繼資料中的事件產生關聯的方法,並指定是否要包括非公用方法。Returns the methods that have been associated with the event in metadata using the .other directive, specifying whether to include non-public methods.

GetRaiseMethod() GetRaiseMethod() GetRaiseMethod() GetRaiseMethod()

傳回引發事件時所呼叫的方法。Returns the method that is called when the event is raised.

GetRaiseMethod(Boolean) GetRaiseMethod(Boolean) GetRaiseMethod(Boolean) GetRaiseMethod(Boolean)

在衍生類別中覆寫時,傳回在引發事件時所呼叫的方法,指定是否要傳回非公用方法。When overridden in a derived class, returns the method that is called when the event is raised, specifying whether to return non-public methods.

GetRemoveMethod() GetRemoveMethod() GetRemoveMethod() GetRemoveMethod()

傳回用來從事件來源移除事件處理常式委派的方法。Returns the method used to remove an event handler delegate from the event source.

GetRemoveMethod(Boolean) GetRemoveMethod(Boolean) GetRemoveMethod(Boolean) GetRemoveMethod(Boolean)

在衍生類別中覆寫時,擷取 MethodInfo 物件以移除事件的方法,指定是否要傳回非公用方法。When overridden in a derived class, retrieves the MethodInfo object for removing a method of the event, specifying whether to return non-public methods.

GetType() GetType() GetType() GetType()
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 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
RemoveEventHandler(Object, Delegate) RemoveEventHandler(Object, Delegate) RemoveEventHandler(Object, Delegate) RemoveEventHandler(Object, Delegate)

從事件來源移除事件處理常式。Removes an event handler from an event source.

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

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

運算子

Equality(EventInfo, EventInfo) Equality(EventInfo, EventInfo) Equality(EventInfo, EventInfo) Equality(EventInfo, EventInfo)

表示兩個 EventInfo 物件是否相等。Indicates whether two EventInfo objects are equal.

Inequality(EventInfo, EventInfo) Inequality(EventInfo, EventInfo) Inequality(EventInfo, EventInfo) Inequality(EventInfo, EventInfo)

表示兩個 EventInfo 物件是否不相等。Indicates whether two EventInfo 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
_EventInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _EventInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _EventInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _EventInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。Maps a set of names to a corresponding set of dispatch identifiers.

_EventInfo.GetType() _EventInfo.GetType() _EventInfo.GetType() _EventInfo.GetType()

傳回表示 EventInfo 類型的 T:System.Type 物件。Returns a T:System.Type object representing the EventInfo type.

_EventInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _EventInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _EventInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _EventInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取物件的類型資訊,可以用來取得介面的類型資訊。Retrieves the type information for an object, which can then be used to get the type information for an interface.

_EventInfo.GetTypeInfoCount(UInt32) _EventInfo.GetTypeInfoCount(UInt32) _EventInfo.GetTypeInfoCount(UInt32) _EventInfo.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

_EventInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _EventInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _EventInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _EventInfo.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)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。Maps a set of names to a corresponding set of dispatch identifiers.

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

取得 Type 物件,表示 MemberInfo 類別。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.

GetAddMethod(EventInfo) GetAddMethod(EventInfo) GetAddMethod(EventInfo) GetAddMethod(EventInfo)
GetAddMethod(EventInfo, Boolean) GetAddMethod(EventInfo, Boolean) GetAddMethod(EventInfo, Boolean) GetAddMethod(EventInfo, Boolean)
GetRaiseMethod(EventInfo) GetRaiseMethod(EventInfo) GetRaiseMethod(EventInfo) GetRaiseMethod(EventInfo)
GetRaiseMethod(EventInfo, Boolean) GetRaiseMethod(EventInfo, Boolean) GetRaiseMethod(EventInfo, Boolean) GetRaiseMethod(EventInfo, Boolean)
GetRemoveMethod(EventInfo) GetRemoveMethod(EventInfo) GetRemoveMethod(EventInfo) GetRemoveMethod(EventInfo)
GetRemoveMethod(EventInfo, Boolean) GetRemoveMethod(EventInfo, Boolean) GetRemoveMethod(EventInfo, Boolean) GetRemoveMethod(EventInfo, Boolean)
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.