C# – C pointers in C#


Is this function declaration in C#:

void foo(string mystring)

the same as this one in C:

void foo(char *)

i.e. In C#, does the called function receive a pointer behind the scenes?

Best Solution

In this specific instance, it is more like:

void foo(const char *);

.Net strings are immutable and passed by reference. However, in general C# receives a pointer or reference to an object behind the scenes.