diff options
Diffstat (limited to 'src/mscorlib/src/System/LowLevelConsole.cs')
-rw-r--r-- | src/mscorlib/src/System/LowLevelConsole.cs | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/mscorlib/src/System/LowLevelConsole.cs b/src/mscorlib/src/System/LowLevelConsole.cs index 316583e276..29e69185ac 100644 --- a/src/mscorlib/src/System/LowLevelConsole.cs +++ b/src/mscorlib/src/System/LowLevelConsole.cs @@ -10,18 +10,14 @@ using Microsoft.Win32.SafeHandles; namespace System { // - // Simple limited console class for internal printf-style debugging in mscorlib - // and low-level tests that just want to depend on mscorlib. + // Simple limited console class for internal printf-style debugging in System.Private.CoreLib + // and low-level tests that want to call System.Private.CoreLib directly // - public static class Console + public static class LowLevelConsole { - static SafeFileHandle _outputHandle; - - static Console() - { - _outputHandle = new SafeFileHandle(Win32Native.GetStdHandle(Win32Native.STD_OUTPUT_HANDLE), false); - } + private static readonly SafeFileHandle _outputHandle = + new SafeFileHandle(Win32Native.GetStdHandle(Win32Native.STD_OUTPUT_HANDLE), false); public static unsafe void Write(string s) { @@ -44,4 +40,26 @@ namespace System Write(Environment.NewLine); } } + + // + // Internal wrapper with the regular name for convenience. Note that it cannot be public to avoid colliding + // with the full Console type. + // + internal static class Console + { + public static void Write(string s) + { + LowLevelConsole.Write(s); + } + + public static void WriteLine(string s) + { + LowLevelConsole.WriteLine(s); + } + + public static void WriteLine() + { + LowLevelConsole.WriteLine(); + } + } } |