本文整理汇总了C#中IPackage.FindAll方法的典型用法代码示例。如果您正苦于以下问题:C# IPackage.FindAll方法的具体用法?C# IPackage.FindAll怎么用?C# IPackage.FindAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackage
的用法示例。
在下文中一共展示了IPackage.FindAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnListElements
private void OnListElements(IPackage package)
{
try
{
sChanged = false;
Application.UseWaitCursor = true;
ContentList.BeginUpdate();
ContentList.Enabled = false;
ContentList.Items.Clear();
IList<IResourceIndexEntry> list = package.FindAll(value => { return true; });
foreach (IResourceIndexEntry entry in list)
{
ListItem item = ListItem.CreateHandler(entry, package);
if (item == null) continue;
ContentList.Items.Add(item);
}
}
finally
{
ContentList.Enabled = true;
ContentList.EndUpdate();
Application.UseWaitCursor = false;
}
}
示例2: Comparer
IEnumerable<Row> Comparer(IPackage pkgA, IPackage pkgB)
{
List<IResourceIndexEntry> leftRKs = pkgA.FindAll(x => true), rightRKs = pkgB.FindAll(x => true);
int left = 0;
int right = 0;
leftRKs.Sort();
rightRKs.Sort();
while (true)
{
Row row = new Row();
if (left < leftRKs.Count)
{
if (right < rightRKs.Count)
{
// both exist
switch (leftRKs[left].CompareTo(rightRKs[right]))
{
case -1:
// left RK < right RK
row.leftRK = leftRKs[left];
row.result = "<";
left++;
break;
case 0:
// same RK
row.leftRK = leftRKs[left];
row.rightRK = rightRKs[right];
row.result = Compare(pkgA, pkgB, leftRKs[left]);//seeing as they're the same
left++;
right++;
break;
case 1:
// left RK > right RK
row.rightRK = rightRKs[right];
row.result = ">";
right++;
break;
}
}
else
{
// left but no right
row.leftRK = leftRKs[left];
row.result = "<";
left++;
}
}
else
{
if (right < rightRKs.Count)
{
// right but no left
row.rightRK = rightRKs[right];
row.result = ">";
right++;
}
else
{
// we're done
yield break;
}
}
yield return row;
}
}