C# Language Pointers The asterisk is part of the type

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 Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

In C and C++, the asterisk in the declaration of a pointer variable is part of the expression being declared. In C#, the asterisk in the declaration is part of the type.

In C, C++ and C#, the following snippet declares an int pointer:

int* a;

In C and C++, the following snippet declares an int pointer and an int variable. In C#, it declares two int pointers:

int* a, b; 

In C and C++, the following snippet declares two int pointers. In C#, it is invalid:

int *a, *b;


Got any C# Language Question?