CodeDelegateInvokeExpression Klasa

Definicja

Reprezentuje wyrażenie, które zgłasza zdarzenie.

public ref class CodeDelegateInvokeExpression : System::CodeDom::CodeExpression
public class CodeDelegateInvokeExpression : System.CodeDom.CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeDelegateInvokeExpression : System.CodeDom.CodeExpression
type CodeDelegateInvokeExpression = class
    inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeDelegateInvokeExpression = class
    inherit CodeExpression
Public Class CodeDelegateInvokeExpression
Inherits CodeExpression
Dziedziczenie
CodeDelegateInvokeExpression
Atrybuty

Przykłady

W poniższym przykładzie pokazano użycie elementu CodeDelegateInvokeExpression , aby wywołać zdarzenie o nazwie TestEvent.

// Invokes the delegates for an event named TestEvent, passing a local object reference and a new System.EventArgs.
array<CodeExpression^>^temp1 = {gcnew CodeThisReferenceExpression,gcnew CodeObjectCreateExpression( "System.EventArgs", nullptr )};
CodeDelegateInvokeExpression^ invoke1 = gcnew CodeDelegateInvokeExpression( gcnew CodeEventReferenceExpression( gcnew CodeThisReferenceExpression,"TestEvent" ),temp1 );

// A C# code generator produces the following source code for the preceeding example code:
//    this.TestEvent(this, new System.EventArgs());
// Invokes the delegates for an event named TestEvent, passing a local object reference and a new System.EventArgs.
CodeDelegateInvokeExpression invoke1 = new CodeDelegateInvokeExpression( new CodeEventReferenceExpression(new CodeThisReferenceExpression(), "TestEvent"),
    new CodeExpression[] { new CodeThisReferenceExpression(), new CodeObjectCreateExpression("System.EventArgs") } );

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

//    this.TestEvent(this, new System.EventArgs());
' Invokes the delegates for an event named TestEvent, passing a local object reference and a new System.EventArgs.
Dim invoke1 As New CodeDelegateInvokeExpression( _
    New CodeEventReferenceExpression(New CodeThisReferenceExpression(), "TestEvent"), _
    New CodeExpression() {New CodeThisReferenceExpression(), New CodeObjectCreateExpression("System.EventArgs")})

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

'   RaiseEvent TestEvent(Me, New System.EventArgs())

Uwagi

CodeDelegateInvokeExpression może służyć do reprezentowania kodu, który wywołuje zdarzenie. Wywołanie zdarzenia wywołuje wszystkich delegatów zarejestrowanych w zdarzeniu przy użyciu określonych parametrów.

Właściwość TargetObject określa zdarzenie do wywołania. Właściwość Parameters określa parametry, które mają być przekazywane do delegatów zdarzenia.

Konstruktory

CodeDelegateInvokeExpression()

Inicjuje nowe wystąpienie klasy CodeDelegateInvokeExpression.

CodeDelegateInvokeExpression(CodeExpression)

Inicjuje CodeDelegateInvokeExpression nowe wystąpienie klasy przy użyciu określonego obiektu docelowego.

CodeDelegateInvokeExpression(CodeExpression, CodeExpression[])

Inicjuje CodeDelegateInvokeExpression nowe wystąpienie klasy przy użyciu określonego obiektu docelowego i parametrów.

Właściwości

Parameters

Pobiera lub ustawia parametry, które mają być przekazywane do metod obsługi zdarzeń dołączonych do zdarzenia.

TargetObject

Pobiera lub ustawia zdarzenie do wywołania.

UserData

Pobiera dane zdefiniowane przez użytkownika dla bieżącego obiektu.

(Odziedziczone po CodeObject)

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy

Zobacz też