本文整理匯總了C#中System.EventArgs.IfNotNull方法的典型用法代碼示例。如果您正苦於以下問題:C# EventArgs.IfNotNull方法的具體用法?C# EventArgs.IfNotNull怎麽用?C# EventArgs.IfNotNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.EventArgs
的用法示例。
在下文中一共展示了EventArgs.IfNotNull方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SendReport
protected void SendReport(TaskBase task, EventArgs<TaskException> args, string body, List<string> files,
string taskStatus)
{
var keyLine = args != null && !args.Value.Key.IsNullOrEmpty() ? " Key " + args.Value.Key : null;
subject = "{0}:{1}.{2}".F(taskStatus, task.Description, keyLine);
var attachment = args.IfNotNull(item => item.Value.Serialize());
SendReport(body, attachment, args.IfNotNull(item => item.Value.Files));
}
示例2: GetMessagePrameters
/// <summary>
/// create array of parameters for message template
/// 0 - DateTime.Now
/// 1 task.Description
/// 2 Status Message
/// 3 Error Message
/// 4 Inner Exception (with stack)
/// 5 User
/// </summary>
/// <param name = "task"></param>
/// <param name = "args"></param>
/// <returns></returns>
protected override object[] GetMessagePrameters(TaskBase task, EventArgs<TaskException> args)
{
var error = (args == null)
? string.Empty
: (args.Value == null)
? string.Empty
: args.Value.Message +
(args.Value.InnerException == null
? string.Empty
: args.Value.InnerException.Message);
var result = new object[]
{
DateTime.Now, task.Description, task.Status.StatusMessage, error,
args.IfNotNull(val => val.Value).IfNotNull(val => val.InnerException),
Config.Instance.WebService.Login
};
return result;
}