Does C# use the -> pointer notation?
There is pointer notation in C#, but only in special cases, using the unsafe
keyword.
Regular objects are dereferenced using .
, but if you want to write fast code, you can pin data (to avoid the garbage collector moving stuff around) and thus "safely" use pointer arithmetic, and then you might need ->
.
See Pointer types (C# Programming Guide) and a bit down in this example on the use of ->
in C#.
It looks something like this (from the last link):
struct MyStruct
{
public long X;
public double D;
}
unsafe static void foo()
{
var myStruct = new MyStruct();
var pMyStruct = & myStruct;
// access:
(*pMyStruct).X = 18;
(*pMyStruct).D = 163.26;
// or
pMyStruct->X = 18;
pMyStruct->D = 163.26;
}