瀏覽代碼

2007-09-06 Atsushi Enomoto <[email protected]>

	* Stream.cs, BufferedStream.cs, MemoryStream.cs: in 2.0 override
	  Dispose(bool) rather than Close().
	  Stream.Dispose() is virtual in 2.0.


svn path=/trunk/mcs/; revision=85389
Atsushi Eno 18 年之前
父節點
當前提交
79faeec3d3

+ 7 - 0
mcs/class/corlib/System.IO/BufferedStream.cs

@@ -111,8 +111,15 @@ namespace System.IO {
 			}
 		}
 
+#if NET_2_0
+		protected override void Dispose (bool disposing)
+		{
+			if (disposed)
+				return;
+#else
 		public override void Close ()
 		{
+#endif
 			if (m_buffer != null)
 				Flush();
 

+ 6 - 0
mcs/class/corlib/System.IO/ChangeLog

@@ -1,3 +1,9 @@
+2007-09-06  Atsushi Enomoto  <[email protected]>
+
+	* Stream.cs, BufferedStream.cs, MemoryStream.cs: in 2.0 override
+	  Dispose(bool) rather than Close().
+	  Stream.Dispose() is virtual in 2.0.
+
 2007-08-24  Gert Driesen  <[email protected]>
 
 	* BinaryReader.cs: Fixed line endings.

+ 4 - 0
mcs/class/corlib/System.IO/MemoryStream.cs

@@ -215,7 +215,11 @@ namespace System.IO
 			}
 		}
 
+#if NET_2_0
+		protected override void Dispose (bool disposing)
+#else
 		public override void Close ()
+#endif
 		{
 			streamClosed = true;
 			expandable = false;

+ 1 - 1
mcs/class/corlib/System.IO/Stream.cs

@@ -139,11 +139,11 @@ namespace System.IO
 			// nothing
 		}
 
-#endif
 		void IDisposable.Dispose ()
 		{
 			Close ();
 		}
+#endif
 
 #if NET_2_0
 		[Obsolete ("CreateWaitHandle is due for removal.  Use \"new ManualResetEvent(false)\" instead.")]