2008-08-21 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / class / corlib / System.IO / TextWriter.cs
index 257ee04fdd5a8a127b5233f77fb5cbc46b0cd982..6f9f2a22f67d7ce84a513fa2ca33c354d0735b94 100644 (file)
@@ -1,5 +1,5 @@
 //
-// System.IO.TextWriter
+// System.IO.TextWriter.cs
 //
 // Authors:
 //   Marcin Szczepanski (marcins@zipworld.com.au)
 
 using System.Text;
 
+#if NET_2_0
+using System.Runtime.InteropServices;
+#endif
+
 namespace System.IO {
 
        [Serializable]
+#if NET_2_0
+       [ComVisible (true)]
+#endif
+#if NET_2_1
+       public abstract class TextWriter : IDisposable {
+#else
        public abstract class TextWriter : MarshalByRefObject, IDisposable {
+#endif
                 
                 protected TextWriter() {
                        CoreNewLine = System.Environment.NewLine.ToCharArray ();
@@ -77,11 +88,20 @@ namespace System.IO {
                         Dispose (true);
                 }
 
-                protected virtual void Dispose (bool disposing) { }
+                protected virtual void Dispose (bool disposing)
+               {
+                       if (disposing){
+                               // If we are explicitly disposed, we can avoid finalization.
+                               GC.SuppressFinalize (this);
+                       }
+               }
 #if NET_2_0
                public void Dispose ()
                {
                        Dispose (true);
+
+                       // If we are explicitly disposed, we can avoid finalization.
+                       GC.SuppressFinalize (this);
                }
 #else
                void System.IDisposable.Dispose () {
@@ -121,11 +141,11 @@ namespace System.IO {
                        // Do nothing
                }
 
-                public virtual void Write (char[] value)
+                public virtual void Write (char[] buffer)
                {
-                       if (value == null)
+                       if (buffer == null)
                                return;
-                       Write (value, 0, value.Length);
+                       Write (buffer, 0, buffer.Length);
                }
                
                 public virtual void Write (decimal value)
@@ -229,9 +249,9 @@ namespace System.IO {
                        WriteLine();
                }
                
-                public virtual void WriteLine (char[] value)
+                public virtual void WriteLine (char[] buffer)
                {
-                       Write (value);
+                       Write (buffer);
                        WriteLine();
                }
                
@@ -650,8 +670,3 @@ namespace System.IO {
                }
        }
 }
-
-
-
-
-