1 #region[操作后给出提示信息] 2 static void WriteErrorInformation(string errorInformation) 3 { 4 Console.ForegroundColor = ConsoleColor.Red; 5 Console.WriteLine("Error: " + errorInformation); 6 Console.ForegroundColor = ConsoleColor.Gray; 7 } 8 static void WriteOuputInformation(string outputInformation) 9 { 10 Console.ForegroundColor = ConsoleColor.DarkGreen; 11 Console.WriteLine("-->>" + outputInformation); 12 Console.ForegroundColor = ConsoleColor.Gray; 13 } 14 #endregion
报错:
WriteErrorInformation(string.Format("Exception: {0}", exp.Message));
成功:
WriteOuputInformation(string.Format("{0}:文档已经存入数据库", DetailUrl));