exceptionshandler.cs

来自「rudp可靠保障得udp传输」· CS 代码 · 共 41 行

CS
41
字号
using System;
using System.Diagnostics;

namespace Helper.Debug
{

	/// <summary>
	/// This class is a central handler for exceptions.
	/// </summary>
	public sealed class ExceptionsHandler
	{

		#region Constructor

		private ExceptionsHandler()
		{
		}

		#endregion

		#region Handle

		[Conditional("DEBUG")]
		public static void Handle(Exception exception, params object[] args)
		{
			string paramsText = "";

			foreach (object val in args)
				paramsText += " - " + val.ToString();

			if (paramsText.Length > 0)
				Console.WriteLine(exception.Message + '(' + paramsText + ")\n" + exception.StackTrace);

			else
				Console.WriteLine(exception.Message + '\n' + exception.StackTrace);
		}

		#endregion

	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?