using System;
using System.Globalization;
using System.Runtime.InteropServices;
namespace System.Collections
{
/// Compares two objects for equivalence, ignoring the case of strings.
/// 2
// Token: 0x02000123 RID: 291
[ComVisible(true)]
[Serializable]
public class CaseInsensitiveComparer : IComparer
{
/// Initializes a new instance of the class using the of the current thread.
// Token: 0x06000F21 RID: 3873 RVA: 0x0003FE68 File Offset: 0x0003E068
public CaseInsensitiveComparer()
{
this.culture = CultureInfo.CurrentCulture;
}
// Token: 0x06000F22 RID: 3874 RVA: 0x0003FE7C File Offset: 0x0003E07C
private CaseInsensitiveComparer(bool invariant)
{
}
/// Initializes a new instance of the class using the specified .
/// The to use for the new .
///
/// is null.
// Token: 0x06000F23 RID: 3875 RVA: 0x0003FE84 File Offset: 0x0003E084
public CaseInsensitiveComparer(CultureInfo culture)
{
if (culture == null)
{
throw new ArgumentNullException("culture");
}
if (culture.LCID != CultureInfo.InvariantCulture.LCID)
{
this.culture = culture;
}
}
/// Gets an instance of that is associated with the of the current thread and that is always available.
/// An instance of that is associated with the of the current thread.
/// 1
///
///
///
// Token: 0x17000256 RID: 598
// (get) Token: 0x06000F25 RID: 3877 RVA: 0x0003FEDC File Offset: 0x0003E0DC
public static CaseInsensitiveComparer Default
{
get
{
return CaseInsensitiveComparer.defaultComparer;
}
}
/// Gets an instance of that is associated with and that is always available.
/// An instance of that is associated with .
/// 1
///
///
///
// Token: 0x17000257 RID: 599
// (get) Token: 0x06000F26 RID: 3878 RVA: 0x0003FEE4 File Offset: 0x0003E0E4
public static CaseInsensitiveComparer DefaultInvariant
{
get
{
return CaseInsensitiveComparer.defaultInvariantComparer;
}
}
/// Performs a case-insensitive comparison of two objects of the same type and returns a value indicating whether one is less than, equal to, or greater than the other.
/// Value Condition Less than zero is less than , with casing ignored. Zero equals , with casing ignored. Greater than zero is greater than , with casing ignored.
/// The first object to compare.
/// The second object to compare.
/// Neither nor implements the interface.-or- and are of different types.
/// 2
// Token: 0x06000F27 RID: 3879 RVA: 0x0003FEEC File Offset: 0x0003E0EC
public int Compare(object a, object b)
{
string text = a as string;
string text2 = b as string;
if (text == null || text2 == null)
{
return Comparer.Default.Compare(a, b);
}
if (this.culture != null)
{
return this.culture.CompareInfo.Compare(text, text2, CompareOptions.IgnoreCase);
}
return CultureInfo.InvariantCulture.CompareInfo.Compare(text, text2, CompareOptions.IgnoreCase);
}
// Token: 0x040003B0 RID: 944
private static CaseInsensitiveComparer defaultComparer = new CaseInsensitiveComparer();
// Token: 0x040003B1 RID: 945
private static CaseInsensitiveComparer defaultInvariantComparer = new CaseInsensitiveComparer(true);
// Token: 0x040003B2 RID: 946
private CultureInfo culture;
}
}