Skip to content

Commit 37da4ee

Browse files
committed
fix: obsolete the public constructor on PhysicalConsole in favor of PhysicalConsole.Singleton
This class was always meant to be a singleton and doesn't have much use as multiple instances because it's just a wrapper around the static System.Console class.
1 parent 42b8994 commit 37da4ee

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/CommandLineUtils/IO/PhysicalConsole.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// This file has been modified from the original form. See Notice.txt in the project root for more information.
44

55
using System;
6+
using System.ComponentModel;
67
using System.IO;
78

89
namespace McMaster.Extensions.CommandLineUtils
@@ -15,13 +16,19 @@ public class PhysicalConsole : IConsole
1516
/// <summary>
1617
/// A shared instance of <see cref="PhysicalConsole"/>.
1718
/// </summary>
19+
#pragma warning disable 0618
1820
public static IConsole Singleton { get; } = new PhysicalConsole();
21+
#pragma warning restore 0618
1922

20-
// TODO: in 3.0 make this type truly a singleton by adding a private ctor
21-
// this is techinally a breaking change, so wait till 3.0
22-
// private PhysicalConsole()
23-
// {
24-
// }
23+
/// <summary>
24+
/// This API is obsolete and will be removed in a future version.
25+
/// The recommended replacement is <see cref="Singleton" />.
26+
/// </summary>
27+
[Obsolete("This API is obsolete and will be removed in a future version." +
28+
"The recommended replacement is PhysicalConsole.Singleton.")]
29+
[EditorBrowsable(EditorBrowsableState.Never)]
30+
public PhysicalConsole()
31+
{ }
2532

2633
/// <summary>
2734
/// <see cref="Console.CancelKeyPress"/>.

0 commit comments

Comments
 (0)