using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Runtime.InteropServices; namespace System { /// Represents a string comparison operation that uses specific case and culture-based or ordinal comparison rules. /// 2 // Token: 0x020006A7 RID: 1703 [ComVisible(true)] [Serializable] public abstract class StringComparer : IComparer, IEqualityComparer, IComparer, IEqualityComparer { /// Gets a object that performs a case-sensitive string comparison using the word comparison rules of the current culture. /// A new object. /// 1 /// /// /// // Token: 0x17000BE8 RID: 3048 // (get) Token: 0x0600408C RID: 16524 RVA: 0x000DBE70 File Offset: 0x000DA070 public static StringComparer CurrentCulture { get { return new CultureAwareComparer(CultureInfo.CurrentCulture, false); } } /// Gets a object that performs case-insensitive string comparisons using the word comparison rules of the current culture. /// A new object. /// 1 /// /// /// // Token: 0x17000BE9 RID: 3049 // (get) Token: 0x0600408D RID: 16525 RVA: 0x000DBE80 File Offset: 0x000DA080 public static StringComparer CurrentCultureIgnoreCase { get { return new CultureAwareComparer(CultureInfo.CurrentCulture, true); } } /// Gets a object that performs a case-sensitive string comparison using the word comparison rules of the invariant culture. /// A new object. /// 1 /// /// /// // Token: 0x17000BEA RID: 3050 // (get) Token: 0x0600408E RID: 16526 RVA: 0x000DBE90 File Offset: 0x000DA090 public static StringComparer InvariantCulture { get { return StringComparer.invariantCulture; } } /// Gets a object that performs a case-insensitive string comparison using the word comparison rules of the invariant culture. /// A new object. /// 1 /// /// /// // Token: 0x17000BEB RID: 3051 // (get) Token: 0x0600408F RID: 16527 RVA: 0x000DBE98 File Offset: 0x000DA098 public static StringComparer InvariantCultureIgnoreCase { get { return StringComparer.invariantCultureIgnoreCase; } } /// Gets a object that performs a case-sensitive ordinal string comparison. /// A object. /// 1 // Token: 0x17000BEC RID: 3052 // (get) Token: 0x06004090 RID: 16528 RVA: 0x000DBEA0 File Offset: 0x000DA0A0 public static StringComparer Ordinal { get { return StringComparer.ordinal; } } /// Gets a object that performs a case-insensitive ordinal string comparison. /// A object. /// 1 // Token: 0x17000BED RID: 3053 // (get) Token: 0x06004091 RID: 16529 RVA: 0x000DBEA8 File Offset: 0x000DA0A8 public static StringComparer OrdinalIgnoreCase { get { return StringComparer.ordinalIgnoreCase; } } /// Creates a object that compares strings according to the rules of a specified culture. /// A new object that performs string comparisons according to the comparison rules used by the parameter and the case rule specified by the parameter. /// A culture whose linguistic rules are used to perform a string comparison. /// true to specify that comparison operations be case-insensitive; false to specify that comparison operations be case-sensitive. /// /// is null. /// 1 // Token: 0x06004092 RID: 16530 RVA: 0x000DBEB0 File Offset: 0x000DA0B0 public static StringComparer Create(CultureInfo culture, bool ignoreCase) { if (culture == null) { throw new ArgumentNullException("culture"); } return new CultureAwareComparer(culture, ignoreCase); } /// When overridden in a derived class, compares two objects and returns an indication of their relative sort order. /// ValueMeaningLess than zero is less than . -or- is null.Zero is equal to .Greater than zero is greater than .-or- is null. /// An object to compare to . /// An object to compare to . /// Neither nor is a object, and neither nor implements the interface. /// 1 // Token: 0x06004093 RID: 16531 RVA: 0x000DBECC File Offset: 0x000DA0CC public int Compare(object x, object y) { if (x == y) { return 0; } if (x == null) { return -1; } if (y == null) { return 1; } string text = x as string; if (text != null) { string text2 = y as string; if (text2 != null) { return this.Compare(text, text2); } } IComparable comparable = x as IComparable; if (comparable == null) { throw new ArgumentException(); } return comparable.CompareTo(y); } /// When overridden in a derived class, indicates whether two objects are equal. /// true if and refer to the same object, or and are both the same type of object and those objects are equal; otherwise, false. /// An object to compare to . /// An object to compare to . /// 1 // Token: 0x06004094 RID: 16532 RVA: 0x000DBF30 File Offset: 0x000DA130 public bool Equals(object x, object y) { if (x == y) { return true; } if (x == null || y == null) { return false; } string text = x as string; if (text != null) { string text2 = y as string; if (text2 != null) { return this.Equals(text, text2); } } return x.Equals(y); } /// When overridden in a derived class, gets the hash code for the specified object. /// A 32-bit signed hash code calculated from the value of the parameter. /// An object. /// /// is null. /// 2 // Token: 0x06004095 RID: 16533 RVA: 0x000DBF80 File Offset: 0x000DA180 public int GetHashCode(object obj) { if (obj == null) { throw new ArgumentNullException("obj"); } string text = obj as string; return (text != null) ? this.GetHashCode(text) : obj.GetHashCode(); } /// When overridden in a derived class, compares two strings and returns an indication of their relative sort order. /// ValueMeaningLess than zero is less than .-or- is null.Zero is equal to .Greater than zero is greater than .-or- is null. /// A string to compare to . /// A string to compare to . /// 1 // Token: 0x06004096 RID: 16534 public abstract int Compare(string x, string y); /// When overridden in a derived class, indicates whether two strings are equal. /// true if and refer to the same object, or and are equal; otherwise, false. /// A string to compare to . /// A string to compare to . /// 1 // Token: 0x06004097 RID: 16535 public abstract bool Equals(string x, string y); /// When overridden in a derived class, gets the hash code for the specified string. /// A 32-bit signed hash code calculated from the value of the parameter. /// A string. /// Not enough memory is available to allocate the buffer required to compute the hash code. /// 2 // Token: 0x06004098 RID: 16536 public abstract int GetHashCode(string obj); // Token: 0x040019A9 RID: 6569 private static StringComparer invariantCultureIgnoreCase = new CultureAwareComparer(CultureInfo.InvariantCulture, true); // Token: 0x040019AA RID: 6570 private static StringComparer invariantCulture = new CultureAwareComparer(CultureInfo.InvariantCulture, false); // Token: 0x040019AB RID: 6571 private static StringComparer ordinalIgnoreCase = new OrdinalComparer(true); // Token: 0x040019AC RID: 6572 private static StringComparer ordinal = new OrdinalComparer(false); } }