Browse Source

* CaseInsensitiveHashCodeProvider.cs: Added support for CultureInfo.
Implemented property DefaultInvariant.

svn path=/trunk/mcs/; revision=24787

Lluis Sanchez 22 years ago
parent
commit
2efebf1552

+ 15 - 5
mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs

@@ -17,13 +17,17 @@ namespace System.Collections {
 	public class CaseInsensitiveHashCodeProvider : IHashCodeProvider {
 
 		private static CaseInsensitiveHashCodeProvider singleton;
+		private static CaseInsensitiveHashCodeProvider singletonInvariant;
+		
+		CultureInfo culture;
 
 
 		// Class constructor
 
 		static CaseInsensitiveHashCodeProvider ()
 		{
-			singleton=new CaseInsensitiveHashCodeProvider ();
+			singleton = new CaseInsensitiveHashCodeProvider ();
+			singletonInvariant = new CaseInsensitiveHashCodeProvider (CultureInfo.InvariantCulture);
 		}
 
 
@@ -34,14 +38,12 @@ namespace System.Collections {
 		{
 		}
 
-		[MonoTODO]
 		public CaseInsensitiveHashCodeProvider (CultureInfo culture)
 		{
-			throw new NotImplementedException ();
+			this.culture = culture;
 		}
 
 
-
 		//
 		// Public static properties
 		//
@@ -52,6 +54,14 @@ namespace System.Collections {
 			}
 		}
 
+#if NET_1_1
+		public static CaseInsensitiveHashCodeProvider DefaultInvariant {
+			get {
+				return singletonInvariant;
+			}
+		}
+#endif
+
 
 		//
 		// Instance methods
@@ -77,7 +87,7 @@ namespace System.Collections {
 
 			int length = str.Length;
 			for (int i = 0;i<length;i++) {
-				c = Char.ToLower (str [i]);
+				c = Char.ToLower (str [i], culture);
 				h = h * 31 + c;
 			}
 

+ 5 - 0
mcs/class/corlib/System.Collections/ChangeLog

@@ -1,3 +1,8 @@
+2004-03-30  Lluis Sanchez Gual <[email protected]>
+
+	* CaseInsensitiveHashCodeProvider.cs: Added support for CultureInfo.
+	  Implemented property DefaultInvariant.
+
 2004-03-29  Lluis Sanchez Gual <[email protected]>
 
 	* CollectionBase.cs: Renamed internal arraylist member to match MS.NET