라벨이 WriteAllBytes인 게시물 표시

[C#] File to Byte Array, Byte Array to File

<File to Byte Array> 1. File Stream을 이용하여 파일을 Byte 배열로 변환   using System.IO; ... public byte[] FileToByteArray(string path) {   byte[] fileBytes = null;   try {     using(FileStream fileStream = new FileSystem(path, FileMode.Open)) {       fileBytes = new byte[fileStream.Length];       fileStream.Read(fileBytes, 0, fileBytes.Length);     }   } catch (Exception e) {     // Exception ...   }   return fileBytes; } <Byte Array to File> 1. FileStream을 사용하여 Byte 배열을 파일로 변환 using System.IO; ... public bool ByteArrayToFile(string path, byte[] buffer) {   try {     using(FileStream fileStream = new FileSystem(path, FileMode.Create)) {       fileStream.Write(buffer, 0, buffer.Length);     }     return true;   } catch (Exception e) { ...