[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;
}

더보기 소개 [C#] File to Byte Array, Byte Array to File