Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added hashcode for DynamicCompositeType for issue #105

  • Loading branch information...
commit aabce67f0823ed4d233d628410ca5931568a69da 1 parent 350f261
Nick Berardi nberardi authored
Showing with 10 additions and 7 deletions.
  1. +3 −6 src/Types/CompositeType.cs
  2. +7 −1 src/Types/DynamicCompositeType.cs
9 src/Types/CompositeType.cs
View
@@ -135,13 +135,10 @@ public override bool Equals(object obj)
public override int GetHashCode()
{
- //Compute a hash from the sum of the parts
- unchecked
- {
+ unchecked {
int hash = 17;
- foreach (var keyPart in _value)
- {
- hash = hash*23 + keyPart.GetHashCode();
+ foreach (var keyPart in _value) {
+ hash = hash * 23 + keyPart.GetHashCode();
}
return hash;
}
8 src/Types/DynamicCompositeType.cs
View
@@ -93,7 +93,13 @@ public override bool Equals(object obj)
public override int GetHashCode()
{
- return _value.GetHashCode();
+ unchecked {
+ int hash = 17;
+ foreach (var keyPart in _value) {
+ hash = hash * 23 + keyPart.GetHashCode();
+ }
+ return hash;
+ }
}
#endregion
Please sign in to comment.
Something went wrong with that request. Please try again.