public static string ToUtf8String(this Stream stream) { if (stream == null) throw new ArgumentNullException(nameof(stream)); using (var reader = new StreamReader(stream, Encoding.UTF8)) { return reader.ReadToEnd(); } }