CodeMemberEvent CodeMemberEvent CodeMemberEvent CodeMemberEvent Class

定義

表示型別事件的宣告。Represents a declaration for an event of a type.

public ref class CodeMemberEvent : System::CodeDom::CodeTypeMember
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeMemberEvent : System.CodeDom.CodeTypeMember
type CodeMemberEvent = class
    inherit CodeTypeMember
Public Class CodeMemberEvent
Inherits CodeTypeMember
繼承
屬性

範例

這個範例示範CodeMemberEvent如何使用來宣告System.EventHandler接受委派的事件:This example demonstrates use of a CodeMemberEvent to declare an event that takes a System.EventHandler delegate:

// Declares an event that accepts a delegate type of System.EventHandler.
CodeMemberEvent^ event1 = gcnew CodeMemberEvent;

// Sets a name for the event.
event1->Name = "TestEvent";

// Sets the type of event.
event1->Type = gcnew CodeTypeReference( "System.EventHandler" );

// A C# code generator produces the following source code for the preceeding example code:
//    private event System.EventHandler TestEvent;
// Declares an event that accepts a delegate type of System.EventHandler.
CodeMemberEvent event1 = new CodeMemberEvent();
// Sets a name for the event.
event1.Name = "TestEvent";
// Sets the type of event.
event1.Type = new CodeTypeReference("System.EventHandler");

// A C# code generator produces the following source code for the preceeding example code:

//    private event System.EventHandler TestEvent;
' Declares an event that accepts a delegate type of System.EventHandler.
Dim event1 As New CodeMemberEvent()
' Sets a name for the event.
event1.Name = "TestEvent"
' Sets the type of event.
event1.Type = New CodeTypeReference("System.EventHandler")

' A Visual Basic code generator produces the following source code for the preceeding example code:

'     Private Event TestEvent As System.EventHandler

備註

CodeMemberEvent可以用來表示類型的事件成員。CodeMemberEvent can be used to represent event members of a type. CodeMemberEvent具有屬性, 可指出事件的資料類型、是否私下執行資料類型, 以及成員事件所執行的介面類別型 (如果有的話)。CodeMemberEvent has properties to indicate the data type of the event, whether it privately implements a data type, and what interface types, if any, the member event implements.

建構函式

CodeMemberEvent() CodeMemberEvent() CodeMemberEvent() CodeMemberEvent()

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

屬性

Attributes Attributes Attributes Attributes

取得或設定成員的屬性 (Attribute)。Gets or sets the attributes of the member.

(Inherited from CodeTypeMember)
Comments Comments Comments Comments

取得型別成員的註解集合。Gets the collection of comments for the type member.

(Inherited from CodeTypeMember)
CustomAttributes CustomAttributes CustomAttributes CustomAttributes

取得或設定成員的自訂屬性。Gets or sets the custom attributes of the member.

(Inherited from CodeTypeMember)
EndDirectives EndDirectives EndDirectives EndDirectives

取得成員的結尾指示詞。Gets the end directives for the member.

(Inherited from CodeTypeMember)
ImplementationTypes ImplementationTypes ImplementationTypes ImplementationTypes

取得或設定成員事件所實作的資料型別。Gets or sets the data type that the member event implements.

LinePragma LinePragma LinePragma LinePragma

取得或設定型別成員陳述式 (Statement) 所在的行。Gets or sets the line on which the type member statement occurs.

(Inherited from CodeTypeMember)
Name Name Name Name

取得或設定成員的名稱。Gets or sets the name of the member.

(Inherited from CodeTypeMember)
PrivateImplementationType PrivateImplementationType PrivateImplementationType PrivateImplementationType

取得或設定私下實作的資料型別 (如果有的話)。Gets or sets the privately implemented data type, if any.

StartDirectives StartDirectives StartDirectives StartDirectives

取得成員的開頭指示詞。Gets the start directives for the member.

(Inherited from CodeTypeMember)
Type Type Type Type

取得或設定處理事件之委派型別的資料型別。Gets or sets the data type of the delegate type that handles the event.

UserData UserData UserData UserData

取得目前物件的使用者可定義資料。Gets the user-definable data for the current object.

(Inherited from CodeObject)

方法

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

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

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

(Inherited from Object)

適用於