In C++ a void pointer can point to anything. It says to the compiler, "Don't check the type of this." The closest translation in c# is Object.
Translating void* from c++ to c#
-
01-07-2022 - |
Domanda
I was translating some managed c++ code to c# and I came across a structure member of type void*. Now, 2 objects of that struct is created, one whose void* member accepts a string and another case accepting address of an int variable.
CK_ATTRIBUTE findTemplate;
findTemplate->pValue = sUserName;
In another case,
int x = 3;
CK_ATTRIBUTE findTemplate;
findTemplate->pValue = &x;
How would I translate this void* member in c#? Has it something to do with IntPtr?
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow