EventSource.EventData EventSource.EventData EventSource.EventData Struct


藉由使用 WriteEvent 方法,為快速建立 WriteEventCore(Int32, Int32, EventSource+EventData*) 多載提供事件資料。Provides the event data for creating fast WriteEvent overloads by using the WriteEventCore(Int32, Int32, EventSource+EventData*) method.

public protected value class EventSource::EventData
protected internal struct EventSource.EventData
Protected Friend Structure EventSource.EventData


下列範例顯示如何使用EventSource.EventData結構。The following example shows how to use the EventSource.EventData structure.

public unsafe void WriteEvent(int eventId, int arg1, int arg2, int arg3, int arg4) {  
    EventData* dataDesc = stackalloc EventProvider.EventData[4];  
    dataDesc[0].DataPointer = (IntPtr)(&arg1);  
    dataDesc[0].Size = 4;  
    dataDesc[1].DataPointer = (IntPtr)(&arg2);  
    dataDesc[1].Size = 4;  
    dataDesc[2].DataPointer = (IntPtr)(&arg3);  
    dataDesc[2].Size = 4;  
    dataDesc[3].DataPointer = (IntPtr)(&arg4);  
    dataDesc[3].Size = 4;  
    WriteEventCore(eventId, 4, (IntPtr)dataDesc);  


DataPointer DataPointer DataPointer

取得或設定新 WriteEvent 多載的資料指標。Gets or sets the pointer to the data for the new WriteEvent overload.

Size Size Size

取得或設定新的 WriteEvent 多載中的承載項目數目。Gets or sets the number of payload items in the new WriteEvent overload.