static void Main(string[] args) { bool require_security = false; bool verbose = false; bool show_help = false; bool name_only = false; bool sorted = false; OptionSet opts = new OptionSet() { { "v", "Display verbose information about type", v => verbose = v != null }, { "s", "Show types which do not require security", v => require_security = v != null }, { "n", "Display name only", v => name_only = v != null }, { "t", "Display sorted by type name", v => sorted = v != null }, { "h|help", "show this message and exit", v => show_help = v != null }, }; HashSet <string> typeFilter = new HashSet <string>(opts.Parse(args), StringComparer.OrdinalIgnoreCase); if (show_help) { ShowHelp(opts); } else { try { IEnumerable <ObjectTypeInfo> types = ObjectTypeInfo.GetTypes(); if (typeFilter.Count > 0) { types = types.Where(t => typeFilter.Contains(t.Name)); } if (require_security) { types = types.Where(t => !t.SecurityRequired); } if (sorted) { types = types.OrderBy(t => t.Name); } if (name_only) { foreach (ObjectTypeInfo type in types) { Console.WriteLine("{0}", type.Name); } } else { if (!verbose) { DumpGenericTypeInfo(types); } else { DumpVerboseTypeInfo(types); } } } catch (Exception ex) { Console.Error.WriteLine(ex.Message); } } }