Here are the examples of the csharp api class Microsoft.ApplicationInsights.Extensibility.Implementation.JsonSerializer.CreateCompressedStream(System.IO.Stream) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
0
1. Example
Project: ApplicationInsights-dotnet
Source File: JsonSerializer.cs
Source File: JsonSerializer.cs
[SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Justification = "Disposing a MemoryStream multiple times is harmless.")] public static byte[] ConvertToByteArray(string telemetryItems, bool compress = true) { if (string.IsNullOrEmpty(telemetryItems)) { throw new ArgumentNullException("telemetryItems"); } var memoryStream = new MemoryStream(); using (Stream compressedStream = compress ? CreateCompressedStream(memoryStream) : memoryStream) using (var streamWriter = new StreamWriter(compressedStream, TransmissionEncoding)) { streamWriter.Write(telemetryItems); } return memoryStream.ToArray(); }
0
2. Example
Project: ApplicationInsights-dotnet
Source File: JsonSerializer.cs
Source File: JsonSerializer.cs
[SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Justification = "Disposing a MemoryStream multiple times is harmless.")] public static byte[] Serialize(IEnumerable<ITelemetry> telemetryItems, bool compress = true) { var memoryStream = new MemoryStream(); using (Stream compressedStream = compress ? CreateCompressedStream(memoryStream) : memoryStream) { using (var streamWriter = new StreamWriter(compressedStream, TransmissionEncoding)) { SeializeToStream(telemetryItems, streamWriter); } } return memoryStream.ToArray(); }