I’m writing a custom JavascriptConverter and I’m testing to see if one the keys received is of type long like this:
if (dictionary.ContainsKey("SomeID"))
{
if (long.TryParse(serializer.ConvertToType<string>(dictionary["ContactID"]), out TheTableID))
{...}
I only want numbers greater or equal to 0. Do I also need to test if it’s a negative number or does the TryParse test for negative numbers?
Thanks.
You either have to test for
>= 0, or useulong.TryParse()instead (which is not really the same thing, but may still fit your needs).