In fact this class does not have the method FromStream()
as shown at documentation. I would need to see what you want to do and find another solution, but the mistake is clear and this cannot be done. The Windows Forms class has this method, according to documentation. If you use it then you can do what you want, but I can’t say it is a good solution (it may work, but only understanding the problem in detail to analyze). Using so should solve the specific problem (even if it causes some other):
using System.Drawing;
probably in place of:
using System.Windows.Controls;
It is not working for other reasons (it does not have a valid data, but the error it claims to have does not happen with the namespace correct), so:
using System.IO;
using System.Drawing;
public class Program {
public static void Main() {
Image.FromStream(new MemoryStream(new byte[1024]));
}
}
Behold working in the ideone. And in the .NET Fiddle. Also put on the Github for future reference.
The error is very clear. What is the namespace of
Image
?– Jéf Bueno
System.Windows.Controls
– Gustavo