notsupportedexception

Create a BitmapImage from a byte array

笑着哭i 提交于 2019-11-26 12:20:00
问题 I am creating a byte array with arbitrary values in it and want to convert it into a BitmapImage. bi = new BitmapImage(); using (MemoryStream stream = new MemoryStream(data)) { try { bi.BeginInit(); bi.CacheOption = BitmapCacheOption.OnLoad; bi.StreamSource = stream; bi.DecodePixelWidth = width; bi.EndInit(); } catch (Exception ex) { return null; } } This code gives me a NotSupportedException all the time. How could I create a BitmapSource from any byte array? 回答1: Given an array of bytes

Why does NotImplementedException exist?

你。 提交于 2019-11-26 06:15:05
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. This really, really urks me, so I hope that someone can give me a reasonable justification for why things are as they are. NotImplementedException. You are pulling my leg, right? No, I\'m not going to take the cheap stab at this by saying, \"hang on, the method is implemented - it throws a NotImplementedException.\" Yes