i have this code:
lvItem.pszText = (IntPtr)(lpRemoteBuffer + Marshal.SizeOf(typeof(LV_ITEM)));
it works fine on 4.0.
if i downgrade the project to 3.5 it gives me this error :
Operator '+' cannot be applied to operands of type 'System.IntPtr' and 'int'
any idea how do i fix that to make it work on 3.5
and i dont know why it works in 4.0 ?
thanks in advance
Yup - if you look at the documentation for the Addition property you'll see that operator was only introduced in .NET 4. You shouldn't need the cast, by the way.
On .NET 3.5 you could probably use:
lvItem.pszText = new IntPtr(lpRemoteBuffer.ToInt64() +
Marshal.SizeOf(typeof(LV_ITEM)));
Of course you then need to hope you're not on a 32-bit system with a pointer which goes over int.MaxValue :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With