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. 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)
if (!PacketPlayer.Playing) { while (queue.Count > 0) { ref byte pinned numRef3; byte[] buffer6; p = (Packet) queue.Dequeue(); if (PacketPlayer.Recording) { switch (path) { case PacketPath.ClientToServer: PacketPlayer.ClientPacket(p); break; case PacketPath.ServerToClient: PacketPlayer.ServerPacket(p); break; } } byte[] buffer3 = p.Compile(); if (((buffer6 = buffer3) == null) || (buffer6.Length == 0)) { numRef3 = null; } else { numRef3 = buffer6; } CopyToBuffer(outBuff, numRef3, buffer3.Length); Packet.Log(path + 1, numRef3, buffer3.Length); numRef3 = null; } }any ideas on what the ref byte pinned is?