Click to See Complete Forum and Search --> : Cannot take the address of, get the size of, or declare a pointer to a managed type (


duongthaiha
March 14th, 2007, 12:50 PM
Hi i am having some problem with C# pointer.

The error that i got back is


Error 1 Cannot take the address of, get the size of, or declare a pointer to a managed type ('DegradeCSharp.Source_Files.PolyLink')

and more same kind of error message

Can you please how can i get away with that error message?
Thanks a lot

Here is the code:
class PolyLink
{
//variable here
unsafe PolyLoop *inner=null;

unsafe PolyLink(PolyLink *p) {
//do something here
}
}
And here is the code for Polyloop

class PolyLoop
{

PolyLoop() {
}

unsafe PolyLoop(PolyLoop *pl) {
//do something here
}



}

Krzemo
March 15th, 2007, 02:55 AM
Unsafe pointers are not needed here. PolyLoop is a reference type, so using PolyLoop variable is like using a pointer.

HTH,
Krzemo.