public static MemoryStream GenerateStreamFromString(string value)
{
return new MemoryStream(Encoding.UTF8.GetBytes(value ?? ""));
}
/// <summary>
/// Convert to memory stream
/// </summary>
/// <param name="stream"></param>
/// <returns></returns>
public static byte[] ReadStream(Stream stream)
{
using (var ms = new MemoryStream())
{
stream.CopyTo(ms);
return ms.ToArray();
}
}