VisualizerObjectSource.Serialize(Stream, Object) Method

Definition

Serializes the specified object into a stream.

By default, objects will be serialized using binary serialization via the BinaryFormatter. However, if the target app does not support binary serialization (as in the case of ASP.NET Core 5.0+ applications), the method will serialize the object using whatever JSON serialization technology is available.

Binary serialization is not supported in out of process visualizers. Therefore, this method will always serialize them using the Newtonsoft.Json library.

public:
 static void Serialize(System::IO::Stream ^ serializationStream, System::Object ^ target);
public static void Serialize (System.IO.Stream serializationStream, object target);
static member Serialize : System.IO.Stream * obj -> unit
Public Shared Sub Serialize (serializationStream As Stream, target As Object)

Parameters

serializationStream
Stream

The stream into which to serialize the object

target
Object

The object to be serialized

Remarks

If Newtonsoft.Json is used, the object will be serialized with the default NewtonSoft JSON Serializer using UTF8 Encoding.

Applies to