According to the MSDN documentation:
Any of the following types may be a
pointer type:
- sbyte, byte, short, ushort, int, uint, long, ulong, char, float,
double, decimal, or bool.
- Any enum type.
- Any pointer type.
- Any user-defined struct type that contains fields of unmanaged types
only.
There's no way to have a pointer to an instance of a class (e.g. pointer to an instance of System.Text.StringBuilder), although you can have a pointer to a class member in the fixed context, as in the following code:
class Test
{
static int x;
int y;
unsafe static void F(int* p) {
*p = 1;
}
static void Main() {
Test t = new Test();
int[] a = new int[10];
unsafe {
fixed (int* p = &x) F(p);
fixed (int* p = &t.y) F(p); // pointer to a member of a class
fixed (int* p = &a[0]) F(p);
fixed (int* p = a) F(p);
}
}
}