summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/IO/TextWriter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/IO/TextWriter.cs')
-rw-r--r--src/mscorlib/src/System/IO/TextWriter.cs37
1 files changed, 4 insertions, 33 deletions
diff --git a/src/mscorlib/src/System/IO/TextWriter.cs b/src/mscorlib/src/System/IO/TextWriter.cs
index 165001e1a6..131f69d35d 100644
--- a/src/mscorlib/src/System/IO/TextWriter.cs
+++ b/src/mscorlib/src/System/IO/TextWriter.cs
@@ -2,24 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-**
-**
-**
-**
-** Purpose: Abstract base class for Text-only Writers.
-** Subclasses will include StreamWriter & StringWriter.
-**
-**
-===========================================================*/
-
-using System;
using System.Text;
using System.Threading;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using System.Reflection;
using System.Security.Permissions;
using System.Globalization;
using System.Diagnostics.CodeAnalysis;
@@ -35,11 +21,7 @@ namespace System.IO {
// There are methods on the Stream class for writing bytes.
[Serializable]
[ComVisible(true)]
-#if FEATURE_REMOTING
public abstract class TextWriter : MarshalByRefObject, IDisposable {
-#else // FEATURE_REMOTING
- public abstract class TextWriter : IDisposable {
-#endif // FEATURE_REMOTING
public static readonly TextWriter Null = new NullTextWriter();
// This should be initialized to Environment.NewLine, but
@@ -128,10 +110,9 @@ namespace System.IO {
}
- [HostProtection(Synchronization=true)]
public static TextWriter Synchronized(TextWriter writer) {
if (writer==null)
- throw new ArgumentNullException("writer");
+ throw new ArgumentNullException(nameof(writer));
Contract.Ensures(Contract.Result<TextWriter>() != null);
Contract.EndContractBlock();
@@ -162,11 +143,11 @@ namespace System.IO {
//
public virtual void Write(char[] buffer, int index, int count) {
if (buffer==null)
- throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
if (index < 0)
- throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
if (count < 0)
- throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
if (buffer.Length - index < count)
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
Contract.EndContractBlock();
@@ -490,7 +471,6 @@ namespace System.IO {
}
#region Task based Async APIs
- [HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public virtual Task WriteAsync(char value)
{
@@ -503,7 +483,6 @@ namespace System.IO {
tuple, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
}
- [HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public virtual Task WriteAsync(String value)
{
@@ -516,7 +495,6 @@ namespace System.IO {
tuple, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
}
- [HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public Task WriteAsync(char[] buffer)
{
@@ -524,7 +502,6 @@ namespace System.IO {
return WriteAsync(buffer, 0, buffer.Length);
}
- [HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public virtual Task WriteAsync(char[] buffer, int index, int count)
{
@@ -537,7 +514,6 @@ namespace System.IO {
tuple, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
}
- [HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public virtual Task WriteLineAsync(char value)
{
@@ -550,7 +526,6 @@ namespace System.IO {
tuple, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
}
- [HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public virtual Task WriteLineAsync(String value)
{
@@ -563,7 +538,6 @@ namespace System.IO {
tuple, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
}
- [HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public Task WriteLineAsync(char[] buffer)
{
@@ -571,7 +545,6 @@ namespace System.IO {
return WriteLineAsync(buffer, 0, buffer.Length);
}
- [HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public virtual Task WriteLineAsync(char[] buffer, int index, int count)
{
@@ -584,14 +557,12 @@ namespace System.IO {
tuple, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
}
- [HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public virtual Task WriteLineAsync()
{
return WriteAsync(CoreNewLine);
}
- [HostProtection(ExternalThreading = true)]
[ComVisible(false)]
public virtual Task FlushAsync()
{