Procházet zdrojové kódy

2005-04-29 Martin Baulig <[email protected]>

	Reflect latest spec changes.

	* IEnumerable.cs (IEnumerable<T>): Implement IEnumerable.
	* IEnumerator.cs (IEnumerator<T>): Implement IEnumerator.


svn path=/trunk/mcs/; revision=43778
Martin Baulig před 21 roky
rodič
revize
6cd22aaa03

+ 7 - 0
mcs/class/corlib/System.Collections.Generic/ChangeLog

@@ -1,3 +1,10 @@
+2005-04-29  Martin Baulig  <[email protected]>
+
+	Reflect latest spec changes.
+
+	* IEnumerable.cs (IEnumerable<T>): Implement IEnumerable.
+	* IEnumerator.cs (IEnumerator<T>): Implement IEnumerator.
+
 2005-04-29  Raja R Harinath  <[email protected]>
 
 	Remove FIXME.

+ 2 - 2
mcs/class/corlib/System.Collections.Generic/IEnumerable.cs

@@ -39,9 +39,9 @@ namespace System.Collections.Generic
 {
 	[CLSCompliant(false)]
 	[ComVisible(false)]
-	public interface IEnumerable<T>
+	public interface IEnumerable<T> : IEnumerable
 	{
-		IEnumerator<T> GetEnumerator ();
+		new IEnumerator<T> GetEnumerator ();
 	}
 }
 #endif

+ 2 - 4
mcs/class/corlib/System.Collections.Generic/IEnumerator.cs

@@ -39,11 +39,9 @@ namespace System.Collections.Generic
 {
 	[CLSCompliant(false)]
 	[ComVisible(false)]
-	public interface IEnumerator<T> : IDisposable
+	public interface IEnumerator<T> : IDisposable, IEnumerator
 	{
-		bool MoveNext ();
-
-		T Current {
+		new T Current {
 			get;
 		}
 	}

+ 6 - 1
mcs/class/corlib/System.Collections.Generic/List.cs

@@ -526,6 +526,11 @@ namespace System.Collections.Generic
 			{
 				return list.GetEnumerator ();
 			}
+
+			IEnumerator IEnumerable.GetEnumerator ()
+			{
+				return ((IEnumerable) list).GetEnumerator ();
+			}
 			
 			public int IndexOf (I item)
 			{
@@ -569,7 +574,7 @@ namespace System.Collections.Generic
 			}
 		}
 		
-		public struct Enumerator : IEnumerator <T>, IEnumerator, IDisposable {
+		public struct Enumerator : IEnumerator <T>, IDisposable {
 			const int NOT_STARTED = -2;
 			
 			// this MUST be -1, because we depend on it in move next.