本文整理汇总了C#中Table.CreateColumn方法的典型用法代码示例。如果您正苦于以下问题:C# Table.CreateColumn方法的具体用法?C# Table.CreateColumn怎么用?C# Table.CreateColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.CreateColumn方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyingProcessorToEntireTableWithColumnsOfDifferentLengths
public void ApplyingProcessorToEntireTableWithColumnsOfDifferentLengths()
{
var table = new Table();
table.CreateColumn("firstname", new[] { "bob", "ben", "bill" });
table.CreateColumn("lastname", new[] { "smith", "jenkins" });
table.Apply(new GenerateFullName());
var fullnames = table.GetData<string>("fullname");
Assert.That(fullnames.Count(), Is.EqualTo(3));
Assert.That(fullnames.Last(), Is.EqualTo("bill unknown"));
}
示例2: ApplyingProcessorToEntireTable
public void ApplyingProcessorToEntireTable()
{
var table = new Table();
table.CreateColumn("firstname", new[] { "bob", "ben" });
table.CreateColumn("lastname", new[] { "smith", "jenkins" });
table.Apply(new GenerateFullName());
var fullnames = table.GetData<string>("fullname");
Assert.That(fullnames.Count(), Is.EqualTo(2));
Assert.That(fullnames.First(), Is.EqualTo("bob smith"));
}
示例3: ConstructStringColumns
private void ConstructStringColumns(Table table, int numColumns, int numRows)
{
Parallel.For(0, numColumns, i =>
{
var strings = Enumerable.Range(0, numRows).Select(s => "string" + s);
table.CreateColumn("string" + i, strings);
});
}
示例4: ConstructDecimalColumns
private void ConstructDecimalColumns(Table table, int numColumns, int numRows)
{
Parallel.For(0, numColumns, i =>
{
var decimals = Enumerable.Range(0, numRows).Select(s => (decimal?)s);
table.CreateColumn("decimal" + i, decimals);
});
}
示例5: ApplyProcessorShort
public void ApplyProcessorShort()
{
var table = new Table();
var column = table.CreateColumn("nums", new int?[] { 3, 4, 5, 6, null, null, null, null, 3, 5 });
table.Apply(column, i => i * 2);
Assert.That(table.GetData(column).First(), Is.EqualTo(6));
}
示例6: ApplyingProcessorToSingleColumn
public void ApplyingProcessorToSingleColumn()
{
var table = new Table();
table.CreateColumn("percentage", new[] { 1.0m, 0.8m, 0.35m });
table.Apply(new MultiplyPercentages());
var columnHeader = table.GetColumnHeader("percentage");
Assert.That(columnHeader.DataColumns.Count(), Is.EqualTo(2));
}
示例7: ShouldCreateColumnWithoutData
public void ShouldCreateColumnWithoutData()
{
var table = new Table();
var columnDefinition = table.CreateColumn<string>("firstname");
Assert.That(columnDefinition.Name, Is.EqualTo("firstname"));
Assert.That(columnDefinition.UnderlyingType, Is.EqualTo(typeof(string)));
var data = table.GetData<string>("firstname");
Assert.That(data.Count(), Is.EqualTo(0));
}