本文整理汇总了C#中Db4objects.Db4o.Foundation.Collection4.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Collection4.Contains方法的具体用法?C# Collection4.Contains怎么用?C# Collection4.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db4objects.Db4o.Foundation.Collection4
的用法示例。
在下文中一共展示了Collection4.Contains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestContains
public virtual void TestContains()
{
object a = new object();
Collection4 c = new Collection4();
c.Add(new object());
Assert.IsFalse(c.Contains(a));
c.Add(a);
Assert.IsTrue(c.Contains(a));
c.Remove(a);
Assert.IsFalse(c.Contains(a));
}
示例2: RandomPositiveIntegersWithoutDuplicates
private IEnumerable RandomPositiveIntegersWithoutDuplicates(int keyCount)
{
var generator = Generators.Take(keyCount, Streams.RandomIntegers());
var res = new Collection4();
var i = generator.GetEnumerator();
while (i.MoveNext())
{
var currentInteger = (int) i.Current;
if (currentInteger < 0)
{
currentInteger = -currentInteger;
}
if (!res.Contains(currentInteger))
{
res.Add(currentInteger);
}
}
return res;
}
示例3: AssertNotContainsNull
private void AssertNotContainsNull(Collection4 c)
{
Assert.IsFalse(c.Contains(null));
Assert.IsNull(c.Get(null));
int size = c.Size();
c.Ensure(null);
Assert.AreEqual(size + 1, c.Size());
c.Remove(null);
Assert.AreEqual(size, c.Size());
}
示例4: AssertContainsNull
private void AssertContainsNull(Collection4 c)
{
Assert.IsTrue(c.Contains(null));
Assert.IsNull(c.Get(null));
var size = c.Size();
c.Ensure(null);
Assert.AreEqual(size, c.Size());
}