public override int GetHashCode() { switch (Kind) { case JObjectKind.Array: return(ArrayValue.GetHashCode()); case JObjectKind.Boolean: return(BooleanValue.GetHashCode()); case JObjectKind.Null: return(0); case JObjectKind.Object: return(ObjectValue.GetHashCode()); case JObjectKind.String: return(StringValue.GetHashCode()); case JObjectKind.Number: if (IsFractional) { return(DoubleValue.GetHashCode()); } if (IsNegative) { return(LongValue.GetHashCode()); } return(ULongValue.GetHashCode()); } return(0); }
public void ShouldCreateNewULongValue() { var val1 = new ULongValue(); val1 = 65L; ulong res = val1; Assert.Equal <ulong>(res, 65L); }
public override int GetHashCode() { unchecked { var hashCode = CharValue.GetHashCode(); hashCode = (hashCode * 397) ^ ByteValue.GetHashCode(); hashCode = (hashCode * 397) ^ SByteValue.GetHashCode(); hashCode = (hashCode * 397) ^ ShortValue.GetHashCode(); hashCode = (hashCode * 397) ^ UShortValue.GetHashCode(); hashCode = (hashCode * 397) ^ IntValue; hashCode = (hashCode * 397) ^ (int)UIntValue; hashCode = (hashCode * 397) ^ LongValue.GetHashCode(); hashCode = (hashCode * 397) ^ ULongValue.GetHashCode(); hashCode = (hashCode * 397) ^ FloatValue.GetHashCode(); hashCode = (hashCode * 397) ^ DoubleValue.GetHashCode(); hashCode = (hashCode * 397) ^ DecimalValue.GetHashCode(); hashCode = (hashCode * 397) ^ DateTimeValue.GetHashCode(); hashCode = (hashCode * 397) ^ GuidValue.GetHashCode(); hashCode = (hashCode * 397) ^ StringValue.GetHashCode(); return(hashCode); } }
public override string ToString() { switch (_type) { case Type.Int: return(IntValue.ToString()); case Type.Short: return(ShortValue.ToString()); case Type.UInt: return(UIntValue.ToString()); case Type.ULong: return(ULongValue.ToString()); case Type.UShort: return(UShortValue.ToString()); case Type.Long: default: return(LongValue.ToString()); } }