本文整理汇总了C#中Db4objects.Db4o.Foundation.Collection4.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Collection4.Remove方法的具体用法?C# Collection4.Remove怎么用?C# Collection4.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db4objects.Db4o.Foundation.Collection4
的用法示例。
在下文中一共展示了Collection4.Remove方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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));
}
示例3: SameContent
public static void SameContent(IEnumerator expected, IEnumerator actual)
{
var allExpected = new Collection4(expected);
while (actual.MoveNext())
{
var current = actual.Current;
var removed = allExpected.Remove(current);
if (!removed)
{
Unexpected(current);
}
}
Assert.IsTrue(allExpected.IsEmpty(), "Still missing: " + allExpected);
}
示例4: SameContent
public static void SameContent(IEnumerator expected, IEnumerator actual)
{
Collection4 allExpected = new Collection4();
while (expected.MoveNext())
{
allExpected.Add(expected.Current);
}
while (actual.MoveNext())
{
object current = actual.Current;
bool removed = allExpected.Remove(current);
if (!removed)
{
Unexpected(current);
}
}
Assert.IsTrue(allExpected.IsEmpty(), allExpected.ToString());
}
示例5: ForInterface
public Collection4 ForInterface(IReflectClass claxx)
{
Collection4 col = new Collection4();
ClassMetadataIterator i = Iterator();
while (i.MoveNext())
{
ClassMetadata clazz = i.CurrentClass();
IReflectClass candidate = clazz.ClassReflector();
if (!candidate.IsInterface())
{
if (claxx.IsAssignableFrom(candidate))
{
col.Add(clazz);
IEnumerator j = new Collection4(col).GetEnumerator();
while (j.MoveNext())
{
ClassMetadata existing = (ClassMetadata)j.Current;
if (existing != clazz)
{
ClassMetadata higher = clazz.GetHigherHierarchy(existing);
if (higher != null)
{
if (higher == clazz)
{
col.Remove(existing);
}
else
{
col.Remove(clazz);
}
}
}
}
}
}
}
return col;
}
示例6: 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));
}
示例7: 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());
}
示例8: TestNulls
public virtual void TestNulls()
{
Collection4 c = new Collection4();
c.Add("one");
AssertNotContainsNull(c);
c.Add(null);
AssertContainsNull(c);
AssertCollection(new string[] { "one", null }, c);
c.Prepend(null);
AssertCollection(new string[] { null, "one", null }, c);
c.Prepend("zero");
c.Add("two");
AssertCollection(new string[] { "zero", null, "one", null, "two" }, c);
AssertContainsNull(c);
c.Remove(null);
AssertCollection(new string[] { "zero", "one", null, "two" }, c);
c.Remove(null);
AssertNotContainsNull(c);
AssertCollection(new string[] { "zero", "one", "two" }, c);
c.Remove(null);
AssertCollection(new string[] { "zero", "one", "two" }, c);
}
示例9: Expect
private bool Expect(IObjectContainer container, string[] names)
{
Collection4 expected = new Collection4(names);
IObjectSet actual = container.Query(typeof(CrashSimulatingTestSuite.CrashData));
while (actual.HasNext())
{
CrashSimulatingTestSuite.CrashData current = (CrashSimulatingTestSuite.CrashData)
actual.Next();
if (!expected.Remove(current._name))
{
return false;
}
}
return expected.IsEmpty();
}
示例10: AssertEntries
private void AssertEntries(PersistentEntry[] expected, IEnumerator actual)
{
Collection4 checklist = new Collection4(actual);
Assert.AreEqual(expected.Length, checklist.Size());
for (int i = 0; i < expected.Length; ++i)
{
PersistentEntry e = expected[i];
PersistentEntry a = EntryByUid(checklist.GetEnumerator(), e.uid);
if (a != null)
{
AssertEqualEntries(e, a);
checklist.Remove(a);
}
}
Assert.IsTrue(checklist.IsEmpty(), checklist.ToString());
}
示例11: AssertIterator
private void AssertIterator(Hashtable4 table, object[] keys)
{
var iter = table.Iterator();
var expected = new Collection4(keys);
while (iter.MoveNext())
{
var entry = (IEntry4) iter.Current;
var removedOK = expected.Remove(entry.Key());
Assert.IsTrue(removedOK);
}
Assert.IsTrue(expected.IsEmpty(), expected.ToString());
}