本文整理汇总了C#中Utility.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Utility.ToString方法的具体用法?C# Utility.ToString怎么用?C# Utility.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public CommandExecutionResult Execute(OpenQA.Selenium.IWebDriver driver)
{
try
{
var o = new Utility().ExecuteScript(driver, Target, Value);
if (!string.IsNullOrEmpty(Value))
{
if (!Value.Equals(o.ToString(), StringComparison.CurrentCultureIgnoreCase))
{
return new CommandExecutionResult { CommandResult = CommandResult.CannotFindElement, Message = string.Format("Cannot find target:{0} value:{1}", Target, Value) };
}
}
return new CommandExecutionResult { CommandResult = CommandResult.Success, Message = string.Empty };
}
catch (TimeoutException ex)
{
return new CommandExecutionResult { CommandResult = CommandResult.TimedOut, Message = ex.Message };
}
catch (Exception ex)
{
return new CommandExecutionResult { CommandResult = CommandResult.Failed, Message = ex.Message };
}
}
示例2: Logger_LogAdded
void Logger_LogAdded( Utility.Logger.LogData data ) {
int index = LogList.Items.Add( data.ToString() );
LogList.TopIndex = index;
}
示例3: WriteLog
public DateTime WriteLog(string logTypeName, Utility.PackingLog.LogBase log)
{
DateTime date = log.Date;
string path = Path.Combine(LOG_PATH, logTypeName);
string pathAndFileName = Path.Combine(path,
string.Format("{0}_{1}.log", logTypeName, date.ToString(@"yyyyMMdd")));
lock (threadRoot)
{
_logQueue.Enqueue(
delegate()
{
if (Directory.Exists(path) == false)
Directory.CreateDirectory(path);
StreamWriter sw = null;
try
{
sw = new StreamWriter(pathAndFileName, true);
sw.WriteLine(log.ToString());
}
catch
{
}
finally
{
if (sw != null)
{
sw.Flush();
sw.Close();
sw.Dispose();
}
}
});
}
return date;
}