问题
How can we declare a void pointer in C#?
回答1:
void* identifier;
as described here
But it needs to be in unsafe as:
unsafe
{
void* identifier;
}
And unsafe code has to have been allowed for the project.
回答2:
I'm assuming you mean in managed code, as your question is rather short to do anything but assume.
I think you're either looking for IntPtr
or simply any object
reference (which is the base type, and the basic equivalent of a null pointer - a reference to "something"). Unless you mean null pointer, in which case you're looking for IntPtr.Zero
.
回答3:
there's something here:
http://msdn.microsoft.com/en-us/library/y31yhkeb%28VS.80%29.aspx
来源:https://stackoverflow.com/questions/3069448/how-to-declare-a-void-pointer-in-c-sharp