本文整理汇总了C#中ListItemCollection.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# ListItemCollection.Delete方法的具体用法?C# ListItemCollection.Delete怎么用?C# ListItemCollection.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListItemCollection
的用法示例。
在下文中一共展示了ListItemCollection.Delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GroupsAreSorted
public void GroupsAreSorted()
{
var list = new ListItemCollection<string>();
list.AddGroup("Bob", new List<string>
{
"Foo",
"Bar"
});
list.AddGroup("Dave", new List<string>
{
"Hello",
"World"
});
list.Should().HaveCount(2);
list[0].Title.Should().Be("Bob");
list[1].Title.Should().Be("Dave");
list.TitleSortOrder = new List<string>
{
"Dave",
"Colin",
"Bob"
};
list.Should().HaveCount(2);
list[0].Title.Should().Be("Dave");
list[1].Title.Should().Be("Bob");
list.AddGroup("Colin", new List<string>
{
"FooBar",
"HelloWorld"
});
list.Should().HaveCount(3);
list[0].Title.Should().Be("Dave");
list[1].Title.Should().Be("Colin");
list[2].Title.Should().Be("Bob");
list.Delete("FooBar");
list.Delete("HelloWorld");
list.Should().HaveCount(2);
list[0].Title.Should().Be("Dave");
list[1].Title.Should().Be("Bob");
}
示例2: DeleteReturnsTrueIfItDeletesTheItem
public void DeleteReturnsTrueIfItDeletesTheItem()
{
var list = new ListItemCollection<string>();
list.AddGroup("Hello", new List<string> { "Foo", "Bar" });
list.Delete("Foo").Should().BeTrue();
}
示例3: DeleteRemovesEmptyGroups
public void DeleteRemovesEmptyGroups()
{
var list = new ListItemCollection<string>();
list.AddGroup("Hello", new List<string> { "Foo", "Bar" });
list.AddGroup("World", new List<string> { "FooBar" });
list.Should().HaveCount(2);
list.Delete("FooBar").Should().BeTrue();
list.Should().HaveCount(1);
list.Should().Contain(g => g.Title == "Hello" && g.Count == 2 &&
g.Contains("Foo") && g.Contains("Bar"));
}
示例4: DeleteReturnsFalseIfTheItemDoesnExist
public void DeleteReturnsFalseIfTheItemDoesnExist()
{
var list = new ListItemCollection<string>();
list.AddGroup("Hello", new List<string> { "Foo", "Bar" });
list.Delete("World").Should().BeFalse();
list.Should().HaveCount(1);
list.Should().Contain(g => g.Title == "Hello" && g.Count == 2 &&
g.Contains("Foo") && g.Contains("Bar"));
}
示例5: DeleteDeletesItem
public void DeleteDeletesItem()
{
var list = new ListItemCollection<string>();
list.AddGroup("Hello", new List<string> { "Foo", "Bar" });
list.Delete("Foo");
list.Should().HaveCount(1);
list.Should().Contain(g => g.Title == "Hello" && g.Count == 1 && g[0] == "Bar");
}