public static T GetOption <T>(string title = null) where T : Enum { var dictionary = MenuTools.GetList(typeof(T)); Console.WriteLine($@" >>>>>>>>{title ?? "请选择操作项:"} {string.Join("\n", dictionary.Select((pair => $"{pair.Value}.{pair.Key}")))} "); return((T)Enum.Parse(typeof(T), Console.ReadLine())); }
private void InitData() { DbTypes = MenuTools.GetList(typeof(DbTypes)); }