I'm looking for a way to perform pointer operations in C# or .NET in particular.
I want to do something very simple
Having a pointer IntPtr I want to get IntPtr object which points to 2 bytes ahead.
I read some post that the foolowing snippet will work...
IntPtr ptr = new IntPtr(oldptr.ToInt32() + 2);
But I have doubts whether this statement is also valid for 64-bit machine (since addressing is in 64-bits there)..
I found this elegant method to add offset, but unfortunately is in .NET 4.0 only http://msdn.microsoft.com/en-us/library/system.intptr.add%28VS.100%29.aspx
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…