Can the following snippet be converted to C#.NET?
template <class cData>
cData Read(DWORD dwAddress)
{
cData cRead; //Generic Variable To Store Data
ReadProcessMemory(hProcess, (LPVOID)dwAddress, &cRead, sizeof(cData), NULL); //Win API - Reads Data At Specified Location
return cRead; //Returns Value At Specified dwAddress
}
This is really helpful when you want to read data from memory in C++ because it's generic: you can use Read<"int">(0x00)"
or Read<"vector">(0x00)
and have it all in one function.
In C#.NET, it's not working for me because, to read memory, you need the DLLImport ReadProcessMemory which has pre-defined parameters, which are not generic of course.