本文整理汇总了C#中Folder.GetAllItemsRecursive方法的典型用法代码示例。如果您正苦于以下问题:C# Folder.GetAllItemsRecursive方法的具体用法?C# Folder.GetAllItemsRecursive怎么用?C# Folder.GetAllItemsRecursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder.GetAllItemsRecursive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveExternalLinksAndKeepInternalLinks
public void RemoveExternalLinksAndKeepInternalLinks()
{
var folder = new Folder("folder");
var internal1 = new DataItem("internal1");
folder.Items.Add(internal1);
var internal2 = new DataItem("internal2");
folder.Items.Add(internal2);
var external = new DataItem("external2");
//internalLink
internal2.LinkTo(internal1);
//externalLink
internal1.LinkTo(external);
folder.GetAllItemsRecursive().OfType<IDataItem>().RemoveOuterDataItemLinks();
Assert.IsFalse(internal1.IsLinked);
Assert.IsTrue(internal2.IsLinked);
}
示例2: GetAllItemsRecursive
public void GetAllItemsRecursive()
{
Folder folder = new Folder();
DataItem dataItem = new DataItem();
var subFolder = new Folder {Name = "subFolder"};
var model = mocks.Stub<IModel>();
Expect.Call(model.GetAllItemsRecursive()).Return(new[] {model}).Repeat.Any();
mocks.ReplayAll();
folder.Items.Add(model);
folder.Items.Add(dataItem);
folder.Items.Add(subFolder);
// no default sorting expect same sequence as adding
Assert.AreEqual(new object[] { model, dataItem, subFolder, folder }, folder.GetAllItemsRecursive().ToArray());
}