本文整理汇总了C#中IDataProvider.GetItems方法的典型用法代码示例。如果您正苦于以下问题:C# IDataProvider.GetItems方法的具体用法?C# IDataProvider.GetItems怎么用?C# IDataProvider.GetItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataProvider
的用法示例。
在下文中一共展示了IDataProvider.GetItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetItemsAccordingToTally
private static IEnumerable<IDataItem> GetItemsAccordingToTally(Dictionary<object[], int> tally, IDataProvider provider, ICollection<DataBinding> bindings,
bool includeDynamicItems)
{
foreach (IDataItem item in provider.GetItems(bindings, includeDynamicItems))
{
object[] values = GetValues(item, bindings);
int count;
if (values != null && tally.TryGetValue(values, out count))
{
yield return item;
count -= 1;
if (count == 0)
tally.Remove(values);
else
tally[values] = count;
}
}
}
示例2: UpdateTally
private static Dictionary<object[], int> UpdateTally(Dictionary<object[], int> oldTally, IDataProvider provider, ICollection<DataBinding> bindings,
bool includeDynamicItems)
{
Dictionary<object[], int> tally = new Dictionary<object[], int>(ArrayEqualityComparer<object>.Default);
int maxCount = int.MaxValue;
foreach (IDataItem item in provider.GetItems(bindings, includeDynamicItems))
{
object[] values = GetValues(item, bindings);
if (values != null)
{
if (oldTally != null && !oldTally.TryGetValue(values, out maxCount))
continue;
int count;
tally.TryGetValue(values, out count);
if (count < maxCount)
{
count += 1;
tally[values] = count;
}
}
}
return tally;
}