C# Language Pointers void*

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

C# inherits from C and C++ the usage of void* as a type-agnostic and size-agnostic pointer.

void* ptr;

Any pointer type can be assigned to void* using an implicit conversion:

int* p1 = (int*)IntPtr.Zero;
void* ptr = p1;

The reverse requires an explicit conversion:

int* p1 = (int*)IntPtr.Zero;
void* ptr = p1;
int* p2 = (int*)ptr;


Got any C# Language Question?