This topic has not yet been rated - Rate this topic

EventSource.WriteEvent Method (Int32, Object[])

.NET Framework 4.5

Writes an event by using the provided event identifier and array of arguments.

Namespace:  System.Diagnostics.Tracing
Assembly:  mscorlib (in mscorlib.dll)
protected void WriteEvent(
	int eventId,
	params Object[] args
)

Parameters

eventId
Type: System.Int32

The event identifier.

args
Type: System.Object[]

An array of objects.

By default, the compiler calls this overload if the parameters for the call do not match one of the other method overloads. This overload is much slower than the other overloads, because it does the following:

  1. It allocates an array to hold the variable argument.

  2. It casts each parameter to an object (which causes allocations for primitive types).

  3. It assigns these objects to the array.

  4. It calls the function, which then determines the type of each argument so it can be serialized for ETW.

The high overhead for this overload is not significant when tracing low-volume events, because the method is used only when the provider is enabled. However, for high-volume events, the performance overhead can be significant. You can avoid using EventSource.WriteEvent for high-volume payloads by creating a new, faster overload with the WriteEventCore method.

.NET Framework

Supported in: 4.5

.NET for Windows Store apps

Supported in: Windows 8

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.