How i get address pointer of a object
If you are willing to use unsafe code you can use pointers. Here is an example from MSDN:
// assume class Point { public int x, y; }
// pt is a managed variable, subject to garbage collection.
Point pt = new Point();
// Using fixed allows the address of pt members to be
// taken, and "pins" pt so it isn't relocated.
fixed ( int* p = &pt.x )
{
*p = 1;
}
However you should probably avoid doing this unless you understand what you are doing and know why you need this feature.
精彩评论