Table of Contents

Method StringFromStreamOrNull

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

StringFromStreamOrNull(Stream?, Encoding?)

Reads a string from the specified stream using the specified encoding. Returns null if the stream is null or if an error occurs during reading.

public static string? StringFromStreamOrNull(Stream? stream, Encoding? encoding = null)

Parameters

stream Stream

The stream to read from. If null, the method returns null.

encoding Encoding

The encoding to use for reading the stream. Optional. If not specified, UTF8 is used.

Returns

string

The string read from the stream, or null if the stream is null or an error occurs.