当前位置: 首页>>代码示例>>C#>>正文


C# IWriter.WriteLine方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:Confirmit,项目名称:Students,代码行数:11,代码来源:Program.cs

示例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();
            }
        }
开发者ID:cwetanow,项目名称:Telerik,代码行数:22,代码来源:Engine.cs

示例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);
        }
开发者ID:AndiDog,项目名称:NSiege,代码行数:17,代码来源:Benchmark.cs

示例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;
            }
        }
开发者ID:AndiDog,项目名称:NSiege,代码行数:26,代码来源:Benchmark.cs

示例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;
//.........这里部分代码省略.........
开发者ID:AndiDog,项目名称:NSiege,代码行数:101,代码来源:Benchmark.cs

示例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()}");
 }
开发者ID:theshaftman,项目名称:Telerik-Academy,代码行数:5,代码来源:Bunny.cs

示例7: Write

 public void Write(IWriter writer)
 {
     writer.WriteLine();
 }
开发者ID:Confirmit,项目名称:Students,代码行数:4,代码来源:WriteLineCommand.cs

示例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));
 }
开发者ID:studware,项目名称:Ange-Git,代码行数:6,代码来源:Bunny.cs


注:本文中的IWriter.WriteLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。