FileStreamをMemoryStreamに変換する方法を教えてください.
C# code
using
(FileStream fs
=
File.OpenRead(filePath)) {
int
length
=
(
int
)fs.Length;
byte
[] data
=
new
byte
[length]; fs.Position
=
0
; fs.Read(data,
0
, length); MemoryStream ms
=
new
MemoryStream(data); }
File.ReadAllBytes(filePath) 。
-
C# code
-
byte
[] data
=
File.ReadAllBytes(filePath); MemoryStream ms
=
new
MemoryStream(data);