TelemetryContext.TryGetRawObject(String, Object) Method

Definition

Returns the raw object with the given key.
Objects retrieved here are not automatically serialized and sent to the backend. They are shared (i.e not cloned) if multiple sinks are configured, so sinks should treat them as read-only.

public bool TryGetRawObject (string key, out object rawObject);
member this.TryGetRawObject : string * obj -> bool
Public Function TryGetRawObject (key As String, ByRef rawObject As Object) As Boolean

Parameters

key
String

The key of the value to get.

rawObject
Object

When this method returns, contains the object that has the specified key, or the default value of the type if the operation failed.

Returns

true if the key was found; otherwise, false.

Remarks

This method is not thread-safe. Objects should be stored from Collectors or TelemetryInitializers that are run synchronously.

Applies to