For such an extension:
public static class ImageExtensions
{
public static Image LoadImage(string path)
{
using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(path)))
return Image.FromStream(ms);
}
}
How to make it possible to be called Image.LoadImage(path)
instead of ImageExtensions.LoadImage(path)
?
I can normally use other extension methods, where their first parameter is this Image img
. Those work by using instance.Method()
.