I have never seen this before – pointers in C#:
public sealed class String : IComparable, ICloneable, IConvertible, IComparable<string>, IEnumerable<char>, IEnumerable, IEquatable<string> {
public String(char* value); // <-- string has a constructor that takes a char pointer?
...
}
I’m curious to get a little understanding.
Is a char pointer something like a pointer in C/C++, i.e. a int value of the same size as a memory location?
I also wonder if my lack of understanding pointers is why I have never fully grasped what the ref keyword does, in other words are they related?
Pointers are used for performance optimization in my understanding, where you break into the field of “unsafe”, and manipulate memory address directly.
In my experience, image processing is one of the areas that you get significant benefits from pointers, like
http://imrannazar.com/Using-Pointers-in-C
Unsafe Pointer iteration and Bitmap – why is UInt64 faster?
There must be other typical scenarios, but a normal C# application does not require pointers generally speaking.