Comments
1 comment
-
I'd have a look at the IL view. The pinned will probably because the local is marked as pinned in the IL.
If I take the following program
struct Foo
{
public byte x;
}
void Test(int input)
{
unsafe
{
Foo foo1 = new Foo();
byte* moo = &foo1.x;
}
}
there will be a local moo
.locals init ([0] valuetype ConsoleApplication1.Program/Foo foo1,
[1] uint8* moo)
Adding a pinned modifier to the local
.locals init ([0] valuetype ConsoleApplication1.Program/Foo foo1,
[1] uint8* pinned moo)
gives a decompilation in Reflector as
Foo foo = new Foo();
byte* pinned numPtr = &foo.x;
Add comment
Please sign in to leave a comment.
(this is from unsafe method)
any ideas on what the ref byte pinned is?