本文整理汇总了C#中DataSet.AddData方法的典型用法代码示例。如果您正苦于以下问题:C# DataSet.AddData方法的具体用法?C# DataSet.AddData怎么用?C# DataSet.AddData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSet
的用法示例。
在下文中一共展示了DataSet.AddData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTuple
public void CreateTuple()
{
DataSet<int> sales = new DataSet<int>("Sales");
sales.AddData(
new Dictionary<string, object>
{
{ "Country", "Canada" },
{ "Year", 2012 }
},
100);
TupleObject<int> tuple = sales.Tuples.First();
Assert.IsNotNull(tuple);
Assert.AreEqual(2, sales.Dimensions.Count);
Assert.AreEqual("Canada", tuple.GetValue("Country"));
Assert.AreEqual(2012, tuple.GetValue("Year"));
Assert.AreEqual(100, tuple.Data);
}
示例2: RaiseIfCreateDimensionAfterAddingData
public void RaiseIfCreateDimensionAfterAddingData()
{
DataSet<int> set = new DataSet<int>("Data");
set.CreateDimension("Country");
set.AddData(
new Dictionary<string, object>
{
{ "Country", "Canada" }
},
100);
set.CreateDimension("Category");
}
示例3: GenerateValue
private static void GenerateValue(DataSet<int> set, IList<string> dimensions, Dictionary<string, object> values, IList<int> nvalues, int position)
{
if (position >= dimensions.Count)
{
set.AddData(values, 1);
return;
}
for (int k = 0; k < nvalues[position]; k++)
{
string value = string.Format("Value {0}", k + 1);
values[dimensions[position]] = value;
GenerateValue(set, dimensions, values, nvalues, position + 1);
}
}
示例4: GetTupleCount
public void GetTupleCount()
{
DataSet<int> sales = new DataSet<int>("Sales");
sales.AddData(
new Dictionary<string, object>()
{
{ "Country", "Argentina" },
{ "Category", "Beverages" },
{ "Product", "Beer" }
},
100);
sales.AddData(
new Dictionary<string, object>()
{
{ "Country", "Argentina" },
{ "Category", "Beverages" },
{ "Product", "Coke" }
},
200);
Assert.AreEqual(2, sales.Tuples.Count());
}