BitmapSource型のプロパティへxmlからデシリアライズたいときなどに BitmapSourceは抽象クラスなのでココではBitmapImageへ変換してます public BitmapSource ByteArrayToImage(byte[] bytes) { if (bytes == null) { return null; } using (var ms = new MemoryStream(bytes)) { var bi = new BitmapImage(); // MemoryStreamを書き込むために準備する bi.BeginInit(); bi.CacheOption = BitmapCacheOption.OnLoad; bi.CreateOptions = BitmapCreateOptions.None; // MemoryStreamを書き込む bi.
![相談天国](https://cdn-ak-scissors.b.st-hatena.com/image/square/126e9c63960837b5815901e11e1f6c1303c17f2b/height=288;version=1;width=512/https%3A%2F%2Fblog.seesaa.jp%2Fimg%2Fogp_logo.png)