本文整理汇总了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);
}
}
}
}
示例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;
}