diff options
author | Jon Skeet <skeet@pobox.com> | 2009-05-28 21:45:43 +0100 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2009-05-28 21:45:43 +0100 |
commit | 43da7ae328b699d9c6e64ea909e348fac3506f73 (patch) | |
tree | cc85fa0319866900fc93b5e90e224550206a5c2b /src/ProtocolBuffers/UnknownField.cs | |
parent | 7ee85c4e9f1a94ff4f0a1adbdeb4716a0c519ea7 (diff) | |
download | protobuf-43da7ae328b699d9c6e64ea909e348fac3506f73.tar.gz protobuf-43da7ae328b699d9c6e64ea909e348fac3506f73.tar.bz2 protobuf-43da7ae328b699d9c6e64ea909e348fac3506f73.zip |
Fix equality of messages to include unknown fields
Diffstat (limited to 'src/ProtocolBuffers/UnknownField.cs')
-rw-r--r-- | src/ProtocolBuffers/UnknownField.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ProtocolBuffers/UnknownField.cs b/src/ProtocolBuffers/UnknownField.cs index 15ab216b..1873e302 100644 --- a/src/ProtocolBuffers/UnknownField.cs +++ b/src/ProtocolBuffers/UnknownField.cs @@ -113,6 +113,29 @@ namespace Google.ProtocolBuffers { get { return groupList; } } + public override bool Equals(object other) { + if (ReferenceEquals(this, other)) { + return true; + } + UnknownField otherField = other as UnknownField; + return otherField != null + && Lists.Equals(varintList, otherField.varintList) + && Lists.Equals(fixed32List, otherField.fixed32List) + && Lists.Equals(fixed64List, otherField.fixed64List) + && Lists.Equals(lengthDelimitedList, otherField.lengthDelimitedList) + && Lists.Equals(groupList, otherField.groupList); + } + + public override int GetHashCode() { + int hash = 43; + hash = hash * 47 + Lists.GetHashCode(varintList); + hash = hash * 47 + Lists.GetHashCode(fixed32List); + hash = hash * 47 + Lists.GetHashCode(fixed64List); + hash = hash * 47 + Lists.GetHashCode(lengthDelimitedList); + hash = hash * 47 + Lists.GetHashCode(groupList); + return hash; + } + /// <summary> /// Constructs a new Builder. /// </summary> |