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


C# CsvRow.AddRange方法代码示例

本文整理汇总了C#中CsvRow.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# CsvRow.AddRange方法的具体用法?C# CsvRow.AddRange怎么用?C# CsvRow.AddRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CsvRow的用法示例。


在下文中一共展示了CsvRow.AddRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WritePlansAndAllLinks

 /// <summary>
 /// Writes a .json file containing all the test plans (and their cases) migrated using TCM.exe
 /// The test cases inside the plans use our custom book keeping structure, MigrationWorkItem.
 /// Also writes a CSV File performing the same thing.
 /// </summary>
 /// <param name="jsonPath">Path of the JSON, originally defined in app.config or altered at runtime</param>
 /// <param name="csvPath">Path of the csv, originally defined in app.config or altered at runtime</param>
 /// <param name="testPlans">A collection of test plans, each with MigrationWorkItems inside</param>
 private static void WritePlansAndAllLinks(string jsonPath, string csvPath, List<MigrationTestPlan> testPlans)
 {
     Trace.WriteLine("\nWriting Plans and Cases to: \n\t" + jsonPath
         + "\n\tand\n\t" + csvPath);
     CsvRow row = new CsvRow();
     row.AddRange(new string[] { "Test Plan Name", "Old ID", "New ID", "Old Area Path" });            
     using (FileStream csvStream = File.Open(csvPath, FileMode.OpenOrCreate))
     using (CsvFileWriter cw = new CsvFileWriter(csvStream))
     using (FileStream jsonStream = File.Open(jsonPath, FileMode.OpenOrCreate))
     using (StreamWriter sw = new StreamWriter(jsonStream))
     using (JsonWriter jw = new JsonTextWriter(sw))
     {
         cw.WriteRow(row);
         foreach (var testPlan in testPlans)
         {
             jw.Formatting = Formatting.Indented;
             JsonSerializer serializer = new JsonSerializer();
             serializer.Serialize(jw, testPlan);
             foreach (var testCase in testPlan.TestCases)
             {
                 row.Clear();
                 row.AddRange(new string[] { testPlan.TestPlanName, testCase.OldID, testCase.NewID, testCase.OldItemAreaPath });
                 cw.WriteRow(row);
             }
         }
     }
 }         
开发者ID:Ryanman,项目名称:CustomTools.AlignMigration,代码行数:35,代码来源:AlignMigration.cs

示例2: WriteHeader

        List<String> WriteHeader(CsvFileWriter writer)
        {
            CsvRow row = new CsvRow();
            List<String> columnNames = new List<string>();
            columnNames.Add(kDateColumnName);
            columnNames.AddRange(this.RegisteredTickerKeys);

            row.AddRange(columnNames);

            writer.WriteRow(row);

            return columnNames;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:13,代码来源:ZooData.cs


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