Browse Source

equality operators are always prefered in C#

since the default object.Equals(object) does nothing more than object.ReferenceEquals(object)
tags/3.0
Licshee 8 years ago
parent
commit
b08e24c49f
2 changed files with 5 additions and 4 deletions
  1. +3
    -3
      shadowsocks-csharp/3rd/zxing/common/reedsolomon/GenericGFPoly.cs
  2. +2
    -1
      shadowsocks-csharp/3rd/zxing/qrcode/encoder/Encoder.cs

+ 3
- 3
shadowsocks-csharp/3rd/zxing/common/reedsolomon/GenericGFPoly.cs View File

@@ -145,7 +145,7 @@ namespace ZXing.Common.ReedSolomon
internal GenericGFPoly addOrSubtract(GenericGFPoly other) internal GenericGFPoly addOrSubtract(GenericGFPoly other)
{ {
if (!field.Equals(other.field))
if (field != other.field)
{ {
throw new ArgumentException("GenericGFPolys do not have same GenericGF field"); throw new ArgumentException("GenericGFPolys do not have same GenericGF field");
} }
@@ -181,7 +181,7 @@ namespace ZXing.Common.ReedSolomon
internal GenericGFPoly multiply(GenericGFPoly other) internal GenericGFPoly multiply(GenericGFPoly other)
{ {
if (!field.Equals(other.field))
if (field != other.field)
{ {
throw new ArgumentException("GenericGFPolys do not have same GenericGF field"); throw new ArgumentException("GenericGFPolys do not have same GenericGF field");
} }
@@ -246,7 +246,7 @@ namespace ZXing.Common.ReedSolomon
internal GenericGFPoly[] divide(GenericGFPoly other) internal GenericGFPoly[] divide(GenericGFPoly other)
{ {
if (!field.Equals(other.field))
if (field != other.field)
{ {
throw new ArgumentException("GenericGFPolys do not have same GenericGF field"); throw new ArgumentException("GenericGFPolys do not have same GenericGF field");
} }


+ 2
- 1
shadowsocks-csharp/3rd/zxing/qrcode/encoder/Encoder.cs View File

@@ -514,7 +514,8 @@ namespace ZXing.QrCode.Internal
BitArray bits, BitArray bits,
String encoding) String encoding)
{ {
if (mode.Equals(Mode.BYTE))
// TODO: check the purpose of this .Equals(obj)
if (mode == Mode.BYTE)
append8BitBytes(content, bits, encoding); append8BitBytes(content, bits, encoding);
else else
throw new WriterException("Invalid mode: " + mode); throw new WriterException("Invalid mode: " + mode);


Loading…
Cancel
Save