C# - Cast Error
Posted: Mon Aug 25, 2008 9:59 pm
Well I'm working on a RealTimeHalo system for halo 2 vista. I made a Memory Reading/Writing class. But when ever I try to convert a byte array to any other data type, I get an exception that says Unable to cast type "byte[]" to "IConvertable".
I know this conversion works, I've used it in the past. Here is an example:
Any ideas?
I know this conversion works, I've used it in the past. Here is an example:
Code: Select all
public float ReadSingle(int Address)
{
byte[] buffer = new byte[4];
ReadProcessMemory(m_hProcess, new IntPtr(Address + baseaddress), buffer, 4, out Out);
return Convert.ToSingle(buffer);
}