I
Ilyas
Hi
I want to extend the System.IO.File type by having a file ToByteArray
method, however when I attempt to do this:
public static byte[] ToByteArray(this File fileObject, string
filename)
{
FileStream fs = new FileStream(filename, FileMode.Open);
byte[] data = new byte[fs.Length];
fs.Read(data, 0, (int)fs.Length);
fs.Close();
return data;
}
I get the error:static types cannot be used as parameters
Does this mean then I cant use the File type as a parameter, because
its a static type?
How can I extend thie type then, if at all?
I want to extend the System.IO.File type by having a file ToByteArray
method, however when I attempt to do this:
public static byte[] ToByteArray(this File fileObject, string
filename)
{
FileStream fs = new FileStream(filename, FileMode.Open);
byte[] data = new byte[fs.Length];
fs.Read(data, 0, (int)fs.Length);
fs.Close();
return data;
}
I get the error:static types cannot be used as parameters
Does this mean then I cant use the File type as a parameter, because
its a static type?
How can I extend thie type then, if at all?