﻿using System;

namespace ReadLine
{
    public static class ReadLine
    {
        private static KeyHandler _keyHandler;

        static ReadLine()
        {
            _keyHandler = new KeyHandler();
        }

        public static string Read()
        {
            ConsoleKeyInfo keyInfo = Console.ReadKey(true);
            while (keyInfo.Key != ConsoleKey.Enter)
            {
                _keyHandler.Handle(keyInfo);
                keyInfo = Console.ReadKey(true);
            }

            return _keyHandler.Text;
        }
    }
}

﻿using System;

namespace ReadLine
{
    public static class ReadLine
    {
        private static KeyHandler _keyHandler;

        public static string Read()
        {
            _keyHandler = new KeyHandler();
            ConsoleKeyInfo keyInfo = Console.ReadKey(true);
            while (keyInfo.Key != ConsoleKey.Enter)
            {
                _keyHandler.Handle(keyInfo);
                keyInfo = Console.ReadKey(true);
            }

            return _keyHandler.Text;
        }
    }
}

Create new instance of KeyHandler on every call to Read method
Create new instance of KeyHandler on every call to Read method
