Help translating Reflector deconstruction into compilable code

Posted by code poet on Stack Overflow See other posts from Stack Overflow or by code poet
Published on 2010-05-16T07:05:23Z Indexed on 2010/05/16 7:30 UTC
Read the original article Hit count: 253

Filed under:
|
|

So I am Reflector-ing some framework 2.0 code and end up with the following deconstruction

fixed (void* voidRef3 = ((void*) &_someMember))
{
...
}

This won't compile due to 'The right hand side of a fixed statement assignment may not be a cast expression'

I understand that Reflector can only approximate and generally I can see a clear path but this is a bit outside my experience.

Question: what is Reflector trying to describe to me?

Update:

Am also seeing the following

fixed (IntPtr* ptrRef3 = ((IntPtr*) &this._someMember))

Update:

So, as Mitch says, it is not a bitwise operator, but an addressOf operator.

Question is now:

fixed (IntPtr* ptrRef3 = &_someMember)

fails with an 'Cannot implicitly convert type 'xxx*' to 'System.IntPtr*'. An explicit conversion exists (are you missing a cast?)' compilation error.

So I seemed to be damned if I do and damned if I dont. Any ideas?

© Stack Overflow or respective owner

Related posts about c#

Related posts about bitwise