Skip to content

Commit 20408bf

Browse files
committed
Refactor FromArray
1 parent cf9197a commit 20408bf

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

SharpHelpers/SharpHelpers/StreamHelper.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,8 @@ public static Stream FromString(this string stringToConvert)
106106
/// <param name="arrayToConvert"></param>
107107
/// <returns></returns>
108108
public static Stream FromArray(this byte[] arrayToConvert)
109-
{
110-
var stream = new MemoryStream(arrayToConvert.Length);
111-
stream.Write(arrayToConvert, 0, arrayToConvert.Length);
112-
stream.Position = 0;
113-
return stream;
109+
{
110+
return new MemoryStream(arrayToConvert, writable: false);
114111
}
115112

116113
/// <summary>

0 commit comments

Comments
 (0)