public static void Main(string[] args) { var p = new CgProgram(args); try { p.StartConsole(); if (p.PrintHelp()) { return; } p.ParseProgramArgs(); var cgType = Etc.GetCgOfType(p.Assembly, p.TypeName, false, p.ResolveDependencies); var dcs = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(CgType)); using (var std = Console.OpenStandardOutput()) { dcs.WriteObject(std, cgType); std.Flush(); std.Close(); } } catch (Exception ex) { p.PrintToConsole(ex); } Thread.Sleep(NfConfig.ThreadSleepTime);//slight pause }