2 // System.Collections.CaseInsensitiveHashCodeProvider
\r
5 // Sergey Chaban (serge@wildwestsoftware.com)
\r
11 using System.Collections;
\r
15 namespace System.Collections {
\r
18 public class CaseInsensitiveHashCodeProvider : IHashCodeProvider {
\r
20 private static CaseInsensitiveHashCodeProvider singleton;
\r
23 // Class constructor
\r
25 static CaseInsensitiveHashCodeProvider ()
\r
27 singleton=new CaseInsensitiveHashCodeProvider ();
\r
32 // Public instance constructor
\r
34 public CaseInsensitiveHashCodeProvider ()
\r
41 // Public static properties
\r
44 public static CaseInsensitiveHashCodeProvider Default {
\r
56 // IHashCodeProvider
\r
60 public int GetHashCode (object obj)
\r
63 throw new ArgumentNullException ("obj is null");
\r
66 string str = obj as string;
\r
76 if (str.Length > 0) {
\r
77 for (int i = 0;i<str.Length;i++) {
\r
80 if (Char.IsLetter (c))
\r
81 c = Char.ToLower (c);
\r
90 } // CaseInsensitiveHashCodeProvider
\r