[Solved] Decimal.ToUInt64 “Value was either too large or too small for a UInt64
Problem: -5000m is a negative number, which is outside the range of UInt64 (an unsigned type). Solution: use Int64 instead of UInt64 if you want to cope with negative numbers. Note that you can just cast instead of calling Decimal.To…: long x = (long) (production – expense); Alternative: validate that the number is non-negative before … Read more