using System.Globalization;
namespace System
{
[Serializable]
internal sealed class OrdinalComparer:System.StringComparer
{
private bool _ignoreCase;
internal OrdinalComparer(bool ignoreCase):base()
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call instance void System.StringComparer::.ctor()
//IL_0006: ldarg.0
//IL_0007: ldarg.1
//IL_0008: stfld bool System.OrdinalComparer::_ignoreCase
//IL_000d: ret
this._ignoreCase = ignoreCase;
}
public override int Compare(string x,string y)
{
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: ldarg.2
//IL_0002: call bool System.Object::ReferenceEquals(object,
//object)
//IL_0007: brfalse.s IL_000b
//IL_0009: ldc.i4.0
//IL_000a: ret
//IL_000b: ldarg.1
//IL_000c: brtrue.s IL_0010
//IL_000e: ldc.i4.m1
//IL_000f: ret
//IL_0010: ldarg.2
//IL_0011: brtrue.s IL_0015
//IL_0013: ldc.i4.1
//IL_0014: ret
//IL_0015: ldarg.0
//IL_0016: ldfld bool System.OrdinalComparer::_ignoreCase
//IL_001b: brfalse.s IL_0025
//IL_001d: ldarg.1
//IL_001e: ldarg.2
//IL_001f: call int32 System.Globalization.TextInfo::CompareOrdinalIgnoreCase(string,
//string)
//IL_0024: ret
//IL_0025: ldarg.1
//IL_0026: ldarg.2
//IL_0027: call int32 System.String::CompareOrdinal(string,
//string)
//IL_002c: ret
if (object.ReferenceEquals(x, y))
{
return 0;
}
else if (x == null)
{
return -1;
}
else if (y == null)
{
return 1;
}
else
{
if (this._ignoreCase)
{
return TextInfo.CompareOrdinalIgnoreCase(x, y);
}
else
{
return string.CompareOrdinal(x, y);
}
}
}
public override bool Equals(string x,string y)
{
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: ldarg.2
//IL_0002: call bool System.Object::ReferenceEquals(object,
//object)
//IL_0007: brfalse.s IL_000b
//IL_0009: ldc.i4.1
//IL_000a: ret
//IL_000b: ldarg.1
//IL_000c: brfalse.s IL_0011
//IL_000e: ldarg.2
//IL_000f: brtrue.s IL_0013
//IL_0011: ldc.i4.0
//IL_0012: ret
//IL_0013: ldarg.0
//IL_0014: ldfld bool System.OrdinalComparer::_ignoreCase
//IL_0019: brfalse.s IL_0036
//IL_001b: ldarg.1
//IL_001c: callvirt instance int32 System.String::get_Length()
//IL_0021: ldarg.2
//IL_0022: callvirt instance int32 System.String::get_Length()
//IL_0027: beq.s IL_002b
//IL_0029: ldc.i4.0
//IL_002a: ret
//IL_002b: ldarg.1
//IL_002c: ldarg.2
//IL_002d: call int32 System.Globalization.TextInfo::CompareOrdinalIgnoreCase(string,
//string)
//IL_0032: ldc.i4.0
//IL_0033: ceq
//IL_0035: ret
//IL_0036: ldarg.1
//IL_0037: ldarg.2
//IL_0038: callvirt instance bool System.String::Equals(string)
//IL_003d: ret
if (object.ReferenceEquals(x, y))
{
return true;
}
else
{
if (x == null)
{
return false;
}
else
{
if (y == null)
{
return false;
}
else
{
if (this._ignoreCase)
{
if (x.Length == y.Length)
{
return TextInfo.CompareOrdinalIgnoreCase(x, y) == 0;
}
else
{
return false;
}
}
else
{
return x.Equals(y);
}
}
}
}
}
public override int GetHashCode(string obj)
{
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "obj"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.0
//IL_000f: ldfld bool System.OrdinalComparer::_ignoreCase
//IL_0014: brfalse.s IL_001d
//IL_0016: ldarg.1
//IL_0017: call int32 System.Globalization.TextInfo::GetHashCodeOrdinalIgnoreCase(string)
//IL_001c: ret
//IL_001d: ldarg.1
//IL_001e: callvirt instance int32 System.Object::GetHashCode()
//IL_0023: ret
if (obj == null)
{
throw new System.ArgumentNullException("obj");
}
else
{
if (this._ignoreCase)
{
return TextInfo.GetHashCodeOrdinalIgnoreCase(obj);
}
else
{
return obj.GetHashCode();
}
}
}
public override bool Equals(object obj)
{
//.maxstack 2
//.locals init (class System.OrdinalComparer V_0)
//IL_0000: ldarg.1
//IL_0001: isinst System.OrdinalComparer
//IL_0006: stloc.0
//IL_0007: ldloc.0
//IL_0008: brtrue.s IL_000c
//IL_000a: ldc.i4.0
//IL_000b: ret
//IL_000c: ldarg.0
//IL_000d: ldfld bool System.OrdinalComparer::_ignoreCase
//IL_0012: ldloc.0
//IL_0013: ldfld bool System.OrdinalComparer::_ignoreCase
//IL_0018: ceq
//IL_001a: ret
OrdinalComparer V_0;
V_0 = obj as OrdinalComparer;
if (V_0 == null)
{
return false;
}
else
{
return this._ignoreCase == V_0._ignoreCase;
}
}
public override int GetHashCode()
{
//.maxstack 2
//.locals init (string V_0,
//int32 V_1)
//IL_0000: ldstr "OrdinalComparer"
//IL_0005: stloc.0
//IL_0006: ldloc.0
//IL_0007: callvirt instance int32 System.Object::GetHashCode()
//IL_000c: stloc.1
//IL_000d: ldarg.0
//IL_000e: ldfld bool System.OrdinalComparer::_ignoreCase
//IL_0013: brtrue.s IL_0017
//IL_0015: ldloc.1
//IL_0016: ret
//IL_0017: ldloc.1
//IL_0018: not
//IL_0019: ret
string V_0;
int V_1;
V_0 = "OrdinalComparer";
V_1=V_0.GetHashCode();
if (this._ignoreCase)
{
return ~V_1;
}
else
{
return V_1;
}
}
}
}