本文整理汇总了C#中IWriter.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# IWriter.WriteLine方法的具体用法?C# IWriter.WriteLine怎么用?C# IWriter.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWriter
的用法示例。
在下文中一共展示了IWriter.WriteLine方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintMatrix
public void PrintMatrix(IWriter writer)
{
for (int i = 0; i < N; i++)
{
for (int j = 0; j < M; j++)
{
writer.Write(Value[i, j].ToString());
}
writer.WriteLine();
}
}
示例2: Start
public static void Start(IReader reader, IWriter writer, ICommandParser parser)
{
Setup(reader, writer, parser);
var command = reader.ReadLine();
while (command != GlobalConstants.EndExecutionCommand)
{
try
{
var result = commandParser.ParseCommand(command);
writer.WriteLine(result);
}
catch (Exception e)
{
writer.WriteLine(e.Message);
}
command = reader.ReadLine();
}
}
示例3: PrintSettings
protected virtual void PrintSettings(IWriter writer)
{
writer.WriteLine("- Mode: {0}", Settings.Mode.ToFriendlyString());
writer.WriteLine("- Concurrency: {0}", Settings.Concurrency);
if(Settings.NumberOfExecutionsToRun != null)
writer.WriteLine("- Executing {0} times", Settings.NumberOfExecutionsToRun.Value);
if(Settings.TimeToRun != null)
writer.WriteLine("- Running for {0}", Settings.TimeToRun.Value);
if(Settings.MaxNumberOfExecutionsToRun != null)
writer.WriteLine("- Stopping after {0} executions", Settings.MaxNumberOfExecutionsToRun.Value);
if(Settings.MaxTimeToRun != null)
writer.WriteLine("- Stopping after {0}", Settings.MaxTimeToRun.Value);
}
示例4: PrintBenchmarkDetailsImpl
protected virtual void PrintBenchmarkDetailsImpl(bool useColors, bool debug, IWriter writer)
{
var foregroundColor = Console.ForegroundColor;
try
{
if(useColors)
Console.ForegroundColor = ConsoleColor.Cyan;
writer.WriteLine("Benchmark name: {0}", Name ?? "<no name assigned>");
if(useColors)
Console.ForegroundColor = ConsoleColor.Yellow;
writer.WriteLine("Settings:");
Console.ForegroundColor = foregroundColor;
PrintSettings(writer);
}
finally
{
if(useColors)
Console.ForegroundColor = foregroundColor;
}
}
示例5: PrintResultDetailsImpl
protected static void PrintResultDetailsImpl(BenchmarkResult result, bool printThreadResults, bool useColors, TimePeriod periodForPerformanceDisplay, bool debug, IWriter writer)
{
if(periodForPerformanceDisplay == null)
periodForPerformanceDisplay = TimePeriod.Second;
var foregroundColor = Console.ForegroundColor;
try
{
if(useColors)
Console.ForegroundColor = ConsoleColor.Cyan;
writer.WriteLine("Result: {0}", result.ResultName ?? "<no name assigned>");
writer.WriteLine("Mode: {0}", result.Mode.ToFriendlyString());
if(useColors)
Console.ForegroundColor = foregroundColor;
if(debug)
writer.WriteLine("Test took {0}", result.CompleteElapsedTime);
if(printThreadResults)
{
if(useColors)
Console.ForegroundColor = ConsoleColor.Yellow;
writer.WriteLine("Single threads:");
if(useColors)
Console.ForegroundColor = foregroundColor;
}
uint completedExecutionsSum = 0; // debugging only, see below
var elapsedTimeSum = TimeSpan.Zero;
var executionsPerPeriodPerThread = new double[result.ThreadResults.Length];
for(long i = 0; i < result.ThreadResults.Length; ++i)
{
double executionsPerPeriod = CalculateExecutionsPerPeriod(result.ThreadResults[i].CompletedExecutions,
result.ThreadResults[i].CompleteElapsedTime,
periodForPerformanceDisplay);
if(printThreadResults)
{
if(useColors)
Console.ForegroundColor = ConsoleColor.Yellow;
writer.WriteLine("- Thread #{0}", i + 1);
if(useColors)
Console.ForegroundColor = foregroundColor;
writer.WriteLine(" Took {0}", result.ThreadResults[i].CompleteElapsedTime);
writer.WriteLine(" Executed {0} times", result.ThreadResults[i].CompletedExecutions);
writer.WriteLine(" {0:#.##} executions/{1}{2}",
executionsPerPeriod,
periodForPerformanceDisplay.Name,
result.Mode == BenchmarkMode.USER_SIMULATION
? " (user simulation mode: waiting time not considered)"
: string.Empty);
writer.WriteLine(" One execution took {0} in average", result.ThreadResults[i].AverageTimePerExecution);
if(debug)
writer.WriteLine(" Stop reason {0}", result.ThreadResults[i].StopReason);
if(result.ThreadResults[i].FirstUncountedException != null ||
(result.ExceptionMode == ExceptionMode.COUNT &&
result.ThreadResults[i].FirstCountedException != null))
{
if(useColors)
Console.ForegroundColor = ConsoleColor.Red;
writer.WriteLine(" Test execution led to an exception in this thread:");
if(result.ThreadResults[i].FirstUncountedException != null)
writer.WriteLine(" first uncounted: {0}",
FormatException(result.ThreadResults[i].FirstUncountedException));
if(result.ExceptionMode == ExceptionMode.COUNT &&
result.ThreadResults[i].FirstCountedException != null)
{
writer.WriteLine(" first counted: {0}",
FormatException(result.ThreadResults[i].FirstCountedException));
writer.WriteLine(" number of counted exceptions: {0}",
result.ThreadResults[i].ExceptionCount);
}
if(useColors)
Console.ForegroundColor = foregroundColor;
}
}
completedExecutionsSum += result.ThreadResults[i].CompletedExecutions;
elapsedTimeSum += result.ThreadResults[i].CompleteElapsedTime;
executionsPerPeriodPerThread[i] = executionsPerPeriod;
}
if(result.HasErrors)
{
if(useColors)
Console.ForegroundColor = ConsoleColor.Red;
//.........这里部分代码省略.........
示例6: Introduce
public void Introduce(IWriter writer)
{
writer.WriteLine($"{this.Name} - \"I am {this.Age} years old!\"");
writer.WriteLine($"{this.Name} - \"And I am {this.FurType.ToString().SplitToSeparateWordsByUppercaseLetter()}");
}
示例7: Write
public void Write(IWriter writer)
{
writer.WriteLine();
}
示例8: Introduce
public void Introduce(IWriter writer)
{
writer.WriteLine(string.Format("{0} - \"I am {1} years old!\"", this.Name, this.Age));
string fur = this.FurType.ToString().SplitToSeparateWordsByUppercaseLetter();
writer.WriteLine(string.Format("{0} - \"And I am {1}\"", this.Name, fur));
}