本文整理汇总了C#中Errors.GetDescription方法的典型用法代码示例。如果您正苦于以下问题:C# Errors.GetDescription方法的具体用法?C# Errors.GetDescription怎么用?C# Errors.GetDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Errors
的用法示例。
在下文中一共展示了Errors.GetDescription方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAndLogError
/// <summary>
/// Creates and Logs the error context information for the occurred error
/// </summary>
/// <param name="error">Error code</param>
/// <param name="method">Method where the error occurred</param>
/// <param name="additionalInfo">Additional information for the error</param>
/// <param name="exception">Inner Exception</param>
/// <param name="descriptionParameters">Description Parameters</param>
/// <param name="additionalDescriptionParameters">Additional Description Parameters</param>
/// <param name="shortName">Shortname of the business error occured for</param>
/// <param name="arguments">Arguments to log of the method where the error occurred</param>
/// <returns>Error context information</returns>
public static ErrorContextInformation CreateAndLogError(Errors error, string method, string additionalInfo = null, Exception exception = null,
object[] descriptionParameters = null, object[] additionalDescriptionParameters = null, string shortName = "", params object[] arguments)
{
return new ErrorContextInformation(error.ToString(), error.GetDescription(descriptionParameters), method,
additionalInformation: string.IsNullOrEmpty(additionalInfo)
? error.GetAdditionalDescription(additionalDescriptionParameters)
: (additionalDescriptionParameters == null
? additionalInfo
: string.Format(additionalInfo, additionalDescriptionParameters)),
innerException: exception, shortName: shortName, arguments: arguments);
}