29 lines
621 B
C#
29 lines
621 B
C#
|
|
using System;
|
||
|
|
using System.IO;
|
||
|
|
|
||
|
|
namespace BMA.EHR.Organization.Service.Extensions
|
||
|
|
{
|
||
|
|
public static class StreamExtension
|
||
|
|
{
|
||
|
|
#region " Methods "
|
||
|
|
|
||
|
|
#region " Public "
|
||
|
|
|
||
|
|
public static string ToBase64(this MemoryStream stream)
|
||
|
|
{
|
||
|
|
stream.Seek(0, SeekOrigin.Begin);
|
||
|
|
byte[] bytes;
|
||
|
|
using (var memoryStream = new MemoryStream())
|
||
|
|
{
|
||
|
|
stream.CopyTo(memoryStream);
|
||
|
|
bytes = memoryStream.ToArray();
|
||
|
|
}
|
||
|
|
|
||
|
|
return Convert.ToBase64String(bytes);
|
||
|
|
}
|
||
|
|
|
||
|
|
#endregion
|
||
|
|
|
||
|
|
#endregion
|
||
|
|
}
|
||
|
|
}
|