diff options
author | Jon Skeet <skeet@pobox.com> | 2015-06-09 19:30:44 +0100 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2015-06-09 19:30:44 +0100 |
commit | e38294a62d7f37c0661273a9a26fda16d557423f (patch) | |
tree | 316989251907553408e7b32a12792f496333e075 /csharp/src/ProtocolBuffers/ByteString.cs | |
parent | f52426827e4d5e8da7d205af538799740b5199b9 (diff) | |
download | protobuf-e38294a62d7f37c0661273a9a26fda16d557423f.tar.gz protobuf-e38294a62d7f37c0661273a9a26fda16d557423f.tar.bz2 protobuf-e38294a62d7f37c0661273a9a26fda16d557423f.zip |
First pass at the mutable API. Quite a bit more to do - in particular, it's pretty slow right now.
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)
|