Browse Source

2008-08-27 Daniel Morgan <[email protected]>

	* System.Data.Common/DbConnectionStringBuilder.cs: Keys and Values
	get properties should return a ReadOnlyCollection

svn path=/trunk/mcs/; revision=111751
Daniel Morgan 17 years ago
parent
commit
b2bfffeaec

+ 5 - 0
mcs/class/System.Data/ChangeLog

@@ -1,3 +1,8 @@
+2008-08-27  Daniel Morgan <[email protected]>
+
+	* System.Data.Common/DbConnectionStringBuilder.cs: Keys and Values
+	get properties should return a ReadOnlyCollection
+
 2008-07-28  Gert Driesen  <[email protected]>
 
 	* System.Data_test.dll.sources: Added SqlNotificationRequestTest.cs.

+ 14 - 4
mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs

@@ -31,9 +31,9 @@ using System;
 using System.Text;
 using System.Reflection;
 using System.Collections;
-using System.ComponentModel;
 using System.Collections.Generic;
-
+using System.Collections.ObjectModel;
+using System.ComponentModel;
 using System.Data;
 using System.Data.Common;
 
@@ -138,7 +138,12 @@ namespace System.Data.Common
 		[Browsable (false)]
                 public virtual ICollection Keys
                 {
-                        get { return _dictionary.Keys; }
+                        get { 
+				string [] keys = new string [_dictionary.Keys.Count];
+				((ICollection<string>) _dictionary.Keys).CopyTo (keys, 0);
+				ReadOnlyCollection<string> keyColl = new ReadOnlyCollection<string> (keys);
+				return keyColl; 
+			}
                 }
 
                 bool ICollection.IsSynchronized
@@ -160,7 +165,12 @@ namespace System.Data.Common
 		[Browsable (false)]
                 public virtual ICollection Values
                 {
-                        get { return _dictionary.Values; }
+                        get { 
+				object [] values = new object [_dictionary.Values.Count];
+				((ICollection<object>) _dictionary.Values).CopyTo (values, 0);
+				ReadOnlyCollection<object> valuesColl = new ReadOnlyCollection<object> (values);
+				return valuesColl; 
+			}
                 }
 
                 #endregion // Properties