詳細はC((zhi)とbyte[]の間とbyte[]とstringの間の変換について説明します。


実例は以下の通りです

//    Stream      
public static Image ByteArrayToImage(byte[] iamgebytes) {
  MemoryStream ms = new MemoryStream(iamgebytes);
  Image image = Image.FromStream(ms);
  return image;
}

public static byte[] ImageToByteArray(Image image) {
  MemoryStream ms = new MemoryStream();
  image.Save(ms, image.RawFormat);
  return ms.ToArray();
}

public static string ByteArrayToString(byte[] bytes) {
  return Convert.ToBase64String(bytes);
}

public static string StringToByteArray(string image) {
  return Convert.FromBase64String(image);
}
以上の詳細については、C((zhi)とbyte[]の間とbyte[]とstringの間の転換は、小編集が皆さんに共有するすべての内容です。参考にしていただければ幸いです。どうぞよろしくお願いします。