diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2015-06-19 12:59:07 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2015-06-19 12:59:07 -0700 |
commit | 45b70328f218dc2b3e20191c2cfa92872ef10d04 (patch) | |
tree | 8c4441b6abee41b5e960e7013e5aeb6761616a22 /csharp/src/ProtocolBuffers/ByteString.cs | |
parent | 5b3a8e76356ef2dcb4a87c3fa7323bdec01cf7ce (diff) | |
parent | 50a3a809e849fad5a53be5ccbaefaa02a106b535 (diff) | |
download | protobuf-45b70328f218dc2b3e20191c2cfa92872ef10d04.tar.gz protobuf-45b70328f218dc2b3e20191c2cfa92872ef10d04.tar.bz2 protobuf-45b70328f218dc2b3e20191c2cfa92872ef10d04.zip |
Merge pull request #515 from jskeet/proto3-only
Proto3 experimental C# fork
Diffstat (limited to 'csharp/src/ProtocolBuffers/ByteString.cs')
-rw-r--r-- | csharp/src/ProtocolBuffers/ByteString.cs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/csharp/src/ProtocolBuffers/ByteString.cs b/csharp/src/ProtocolBuffers/ByteString.cs index 434865b7..000914f0 100644 --- a/csharp/src/ProtocolBuffers/ByteString.cs +++ b/csharp/src/ProtocolBuffers/ByteString.cs @@ -40,7 +40,7 @@ using System.Collections.Generic; using System.IO;
using System.Text;
-namespace Google.ProtocolBuffers
+namespace Google.Protobuf
{
/// <summary>
/// Immutable array of bytes.
@@ -208,6 +208,24 @@ namespace Google.ProtocolBuffers return CodedInputStream.CreateInstance(bytes);
}
+ public static bool operator ==(ByteString lhs, ByteString rhs)
+ {
+ if (ReferenceEquals(lhs, rhs))
+ {
+ return true;
+ }
+ if (ReferenceEquals(lhs, null))
+ {
+ return false;
+ }
+ return lhs.Equals(rhs);
+ }
+
+ public static bool operator !=(ByteString lhs, ByteString rhs)
+ {
+ return !(lhs == rhs);
+ }
+
// TODO(jonskeet): CopyTo if it turns out to be required
public override bool Equals(object obj)
|