簡體   English   中英

將System.Drawing.Image轉換為System.Data.Linq.Binary

[英]Converting System.Drawing.Image to System.Data.Linq.Binary

我正在研究在DB中存儲圖像的應用程序。 圖像與一個對象有關,我必須使用Linq。 當我在數據庫中插入對象時,它的圖像是System.Drawing.Image,需要在System.Data.Linq.Binary中進行轉換。

我找到了另一種方式的tutos,但不是這個。

  using (MemoryStream ms = new MemoryStream())
  {
      image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
      var binary = new System.Data.Linq.Binary(ms.GetBuffer());
  }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM