using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp.Menu { internal abstract partial class Entry { public class EntryStep { private Type _entryType; public string Description { get; private set; } public string Input { get; internal set; } internal EntryStep(string description, Type type) { Description = description; Input = ""; _entryType = type; } public object GetEntry() { try { if (_entryType == typeof(string)) return Input; if (_entryType == typeof(int)) return Int32.Parse(Input); if (_entryType == typeof(DateTime)) return DateTime.Parse(Input); } catch (FormatException fe) { Console.Error.WriteLine(fe); } throw new NotImplementedException("Error: parse of this type is not implemented."); } } } }