I have the following sample code snippet:
UInt16 a = 0x3A; UInt16 b = 0xFFDF; UInt16 result = Convert.ToUInt16(a - b);
line 3 error with overflow exception. However, I want to achieve the same result as if I subtracted 2 unsigned shorts in C and they exceeded / underflow.
What is the best way to achieve this?
c # integer-overflow
eKKiM
source share