本文整理汇总了C#中Db4objects.Db4o.Foundation.Collection4.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# Collection4.Clear方法的具体用法?C# Collection4.Clear怎么用?C# Collection4.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db4objects.Db4o.Foundation.Collection4
的用法示例。
在下文中一共展示了Collection4.Clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestContainsAll
public virtual void TestContainsAll()
{
var a = new Item(42);
var b = new Item(a.id + 1);
var c = new Item(b.id + 1);
var a_ = new Item(a.id);
var needle = new Collection4();
var haystack = new Collection4();
haystack.Add(a);
needle.Add(a);
needle.Add(b);
Assert.IsFalse(haystack.ContainsAll(needle));
needle.Remove(b);
Assert.IsTrue(haystack.ContainsAll(needle));
needle.Add(b);
haystack.Add(b);
Assert.IsTrue(haystack.ContainsAll(needle));
needle.Add(a_);
Assert.IsTrue(haystack.ContainsAll(needle));
needle.Add(c);
Assert.IsFalse(haystack.ContainsAll(needle));
needle.Clear();
Assert.IsTrue(haystack.ContainsAll(needle));
haystack.Clear();
Assert.IsTrue(haystack.ContainsAll(needle));
}
示例2: TestContainsAll
public virtual void TestContainsAll()
{
Collection4TestCase.Item a = new Collection4TestCase.Item(42);
Collection4TestCase.Item b = new Collection4TestCase.Item(a.id + 1);
Collection4TestCase.Item c = new Collection4TestCase.Item(b.id + 1);
Collection4TestCase.Item a_ = new Collection4TestCase.Item(a.id);
Collection4 needle = new Collection4();
Collection4 haystack = new Collection4();
haystack.Add(a);
needle.Add(a);
needle.Add(b);
Assert.IsFalse(haystack.ContainsAll(needle));
needle.Remove(b);
Assert.IsTrue(haystack.ContainsAll(needle));
needle.Add(b);
haystack.Add(b);
Assert.IsTrue(haystack.ContainsAll(needle));
needle.Add(a_);
Assert.IsTrue(haystack.ContainsAll(needle));
needle.Add(c);
Assert.IsFalse(haystack.ContainsAll(needle));
needle.Clear();
Assert.IsTrue(haystack.ContainsAll(needle));
haystack.Clear();
Assert.IsTrue(haystack.ContainsAll(needle));
}