Author: miguel
Date: 2005-05-26 11:52:42 -0400 (Thu, 26 May 2005)
New Revision: 45058
Modified:
trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog
trunk/mcs/class/corlib/System.Collections.Generic/Dictionary.cs
trunk/mcs/class/corlib/System.Collections.Generic/IDictionary.cs
trunk/mcs/class/corlib/System.IO/ChangeLog
trunk/mcs/class/corlib/System.IO/File.cs
Log:
2005-05-26 Miguel de Icaza <[EMAIL PROTECTED]>
* Dictionary.cs: Remove the `Hash' name from the Dictionary
internal classes, make them public.
2005-05-26 Miguel de Icaza <[EMAIL PROTECTED]>
* File.cs (ReadAllBytes): add.
Modified: trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog 2005-05-26
15:32:06 UTC (rev 45057)
+++ trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog 2005-05-26
15:52:42 UTC (rev 45058)
@@ -1,3 +1,8 @@
+2005-05-26 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * Dictionary.cs: Remove the `Hash' name from the Dictionary
+ internal classes, make them public.
+
2005-05-26 Zoltan Varga <[EMAIL PROTECTED]>
* Dictionary.cs: Fix a warning.
Modified: trunk/mcs/class/corlib/System.Collections.Generic/Dictionary.cs
===================================================================
--- trunk/mcs/class/corlib/System.Collections.Generic/Dictionary.cs
2005-05-26 15:32:06 UTC (rev 45057)
+++ trunk/mcs/class/corlib/System.Collections.Generic/Dictionary.cs
2005-05-26 15:52:42 UTC (rev 45058)
@@ -224,7 +224,7 @@
}
}
}
-
+
protected virtual int GetHash (K key)
{
//IComparer<K> hcp = this._hcp;
@@ -270,7 +270,13 @@
int spot = (int) ((uint) h % size);
return spot;
}
-
+
+ public IComparer<K> Comparer {
+ get {
+ return _hcp;
+ }
+ }
+
public void Clear ()
{
for (int i = 0; i < _table.Length; i++)
@@ -354,12 +360,28 @@
}
ICollection<K> IDictionary<K, V>.Keys {
- get { return new HashKeyCollection (this); }
+ get {
+ return Keys;
+ }
}
ICollection<V> IDictionary<K, V>.Values {
- get { return new HashValueCollection (this); }
+ get {
+ return Values;
+ }
}
+
+ public KeyCollection Keys {
+ get {
+ return new KeyCollection (this);
+ }
+ }
+
+ public ValueCollection Values {
+ get {
+ return new ValueCollection (this);
+ }
+ }
bool IDictionary.IsFixedSize {
get { return false; }
@@ -589,10 +611,10 @@
}
// This collection is a read only collection
- internal class HashKeyCollection : ICollection<K>,
IEnumerable<K>, ICollection {
+ public class KeyCollection : ICollection<K>, IEnumerable<K>,
ICollection {
Dictionary<K, V> _dictionary;
- public HashKeyCollection (Dictionary<K, V> dictionary)
+ public KeyCollection (Dictionary<K, V> dictionary)
{
_dictionary = dictionary;
}
@@ -696,10 +718,10 @@
}
// This collection is a read only collection
- internal class HashValueCollection : ICollection<V>,
IEnumerable<V>, ICollection {
+ public class ValueCollection : ICollection<V>, IEnumerable<V>,
ICollection, IEnumerable {
Dictionary<K, V> _dictionary;
- public HashValueCollection (Dictionary<K, V> dictionary)
+ public ValueCollection (Dictionary<K, V> dictionary)
{
_dictionary = dictionary;
}
@@ -804,7 +826,6 @@
}
}
-
static bool TestPrime (int x)
{
if ((x & 1) != 0) {
Modified: trunk/mcs/class/corlib/System.Collections.Generic/IDictionary.cs
===================================================================
--- trunk/mcs/class/corlib/System.Collections.Generic/IDictionary.cs
2005-05-26 15:32:06 UTC (rev 45057)
+++ trunk/mcs/class/corlib/System.Collections.Generic/IDictionary.cs
2005-05-26 15:52:42 UTC (rev 45058)
@@ -35,9 +35,14 @@
using System.Runtime.InteropServices;
namespace System.Collections.Generic {
+
[CLSCompliant(true)]
[ComVisible(false)]
- public interface IDictionary<K,V> : ICollection<KeyValuePair<K,V>> {
+ public interface IDictionary<K,V>
+ : ICollection<KeyValuePair<K,V>>
+ // , IEnumerable<KeyValuePair<K,V>>
+ {
+
void Add (K key, V value);
bool ContainsKey (K key);
bool Remove (K key);
Modified: trunk/mcs/class/corlib/System.IO/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.IO/ChangeLog 2005-05-26 15:32:06 UTC (rev
45057)
+++ trunk/mcs/class/corlib/System.IO/ChangeLog 2005-05-26 15:52:42 UTC (rev
45058)
@@ -1,4 +1,7 @@
+2005-05-26 Miguel de Icaza <[EMAIL PROTECTED]>
+ * File.cs (ReadAllBytes): add.
+
Tue May 17 10:54:18 CEST 2005 Paolo Molaro <[EMAIL PROTECTED]>
* FileStream.cs: complete fix for #74971.
Modified: trunk/mcs/class/corlib/System.IO/File.cs
===================================================================
--- trunk/mcs/class/corlib/System.IO/File.cs 2005-05-26 15:32:06 UTC (rev
45057)
+++ trunk/mcs/class/corlib/System.IO/File.cs 2005-05-26 15:52:42 UTC (rev
45058)
@@ -408,5 +408,34 @@
}
#endregion
+
+#if NET_2_0
+ //
+ // The documentation for this method is most likely wrong, it
+ // talks about doing a "binary read", but the remarks say
+ // that this "detects the encoding".
+ //
+ // This can not detect and do anything useful with the encoding
+ // since the result is a byte [] not a char [].
+ //
+ public static byte [] ReadAllBytes (string path)
+ {
+ using (FileStream s = Open (path, FileMode.Open,
FileAccess.Read, FileShare.Read)){
+ long size = s.Length;
+
+ //
+ // Is this worth supporting?
+ //
+ if (size > Int32.MaxValue)
+ throw new ArgumentException ("Reading
more than 4gigs with this call is not supported");
+
+ byte [] result = new byte [s.Length];
+
+ s.Read (result, 0, (int) size);
+
+ return result;
+ }
+ }
+#endif
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches