Forum Discussion
Mike_Thompson_9
Nimbostratus
Aug 08, 2007CommonULong64 OverflowException
I am trying to convert the CommonULong64 type to UInt64 in .NET for a CommonStatistic type. Sometimes this works fine and I get a good number back. Other times I get a System.OverflowException. The...
Mike_Thompson_9
Nimbostratus
Aug 09, 2007There appears to be a problem with the large negative number on the [value.low]. From doing some research, the best method is to turn the negative number in to a positive number, then do the calculation. From what I can tell, this works:
Public Shared Function Build64(ByVal value As Object) As UInt64
Return Convert.ToUInt64((Convert.ToUInt64(value.high) << 32) Or Convert.ToUInt64(Math.Abs(value.low)))
End Function
I am getting a good number back, but I am not 100% sure it is correct. However the exception is gone. Your thoughts?
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects