mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-21 23:00:43 -08:00
Add ConsoleIO implementation and sample program
This commit is contained in:
7
00_Common/dotnet/Games.Common.Sample/Program.cs
Normal file
7
00_Common/dotnet/Games.Common.Sample/Program.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
using Games.Common.IO;
|
||||||
|
|
||||||
|
var io = new ConsoleIO();
|
||||||
|
|
||||||
|
var name = io.ReadString("What's your name");
|
||||||
|
|
||||||
|
io.WriteLine($"Hello, {name}");
|
||||||
16
00_Common/dotnet/Games.Common/IO/ConsoleIO.cs
Normal file
16
00_Common/dotnet/Games.Common/IO/ConsoleIO.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Games.Common.IO
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An implementation of <see cref="IReadWrite" /> with input begin read for STDIN and output being written to
|
||||||
|
/// STDOUT.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class ConsoleIO : TextIO
|
||||||
|
{
|
||||||
|
public ConsoleIO()
|
||||||
|
: base(Console.In, Console.Out)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user