C
colin
Hi,
How can I use a delegate that I can set to call a non static function
but of any instance of the class ?
eg
class TypeTeader<T>
{
delegate T readDelegate<T>();
readDelegate<T> ReadFunction;
public TypeTeader(readDelegate d)
{
ReadFunction=d;
}
public void read<T>(BinaryReader reader,ref T p)
{
//use the ReadFunction delegate to acces the relevant function of reader
}
}
TypeReader<Int32> Int32reader(/*pass ReadInt32 function of BinaryReader*/);
this is ofc simplified,
ive expanded BinaryReader to read countless types.
thanks
Colin =^.^=
How can I use a delegate that I can set to call a non static function
but of any instance of the class ?
eg
class TypeTeader<T>
{
delegate T readDelegate<T>();
readDelegate<T> ReadFunction;
public TypeTeader(readDelegate d)
{
ReadFunction=d;
}
public void read<T>(BinaryReader reader,ref T p)
{
//use the ReadFunction delegate to acces the relevant function of reader
}
}
TypeReader<Int32> Int32reader(/*pass ReadInt32 function of BinaryReader*/);
this is ofc simplified,
ive expanded BinaryReader to read countless types.
thanks
Colin =^.^=