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 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); } }