From fc92500074cdea9424b912e60ca9984d65b18cb6 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Tue, 15 Feb 2022 22:30:40 +1100 Subject: [PATCH] Add ConsoleIO implementation and sample program --- 00_Common/dotnet/Games.Common.Sample/Program.cs | 7 +++++++ 00_Common/dotnet/Games.Common/IO/ConsoleIO.cs | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 00_Common/dotnet/Games.Common.Sample/Program.cs create mode 100644 00_Common/dotnet/Games.Common/IO/ConsoleIO.cs diff --git a/00_Common/dotnet/Games.Common.Sample/Program.cs b/00_Common/dotnet/Games.Common.Sample/Program.cs new file mode 100644 index 00000000..6bd2a8c4 --- /dev/null +++ b/00_Common/dotnet/Games.Common.Sample/Program.cs @@ -0,0 +1,7 @@ +using Games.Common.IO; + +var io = new ConsoleIO(); + +var name = io.ReadString("What's your name"); + +io.WriteLine($"Hello, {name}"); diff --git a/00_Common/dotnet/Games.Common/IO/ConsoleIO.cs b/00_Common/dotnet/Games.Common/IO/ConsoleIO.cs new file mode 100644 index 00000000..842eb01c --- /dev/null +++ b/00_Common/dotnet/Games.Common/IO/ConsoleIO.cs @@ -0,0 +1,16 @@ +using System; + +namespace Games.Common.IO +{ + /// + /// An implementation of with input begin read for STDIN and output being written to + /// STDOUT. + /// + public sealed class ConsoleIO : TextIO + { + public ConsoleIO() + : base(Console.In, Console.Out) + { + } + } +} \ No newline at end of file