本文整理汇总了C#中Db4objects.Db4o.Foundation.Collection4.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Collection4.Add方法的具体用法?C# Collection4.Add怎么用?C# Collection4.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db4objects.Db4o.Foundation.Collection4
的用法示例。
在下文中一共展示了Collection4.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: NewIterator
private CompositeIterator4 NewIterator()
{
Collection4 iterators = new Collection4();
iterators.Add(IntArrays4.NewIterator(new int[] { 1, 2, 3 }));
iterators.Add(IntArrays4.NewIterator(new int[] { }));
iterators.Add(IntArrays4.NewIterator(new int[] { 4 }));
iterators.Add(IntArrays4.NewIterator(new int[] { 5, 6 }));
CompositeIterator4 iterator = new CompositeIterator4(iterators.GetEnumerator());
return iterator;
}
示例3: 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));
}
示例4: IteratorFor
public virtual IEnumerator IteratorFor(object collection)
{
IDictionary map = (IDictionary)collection;
Collection4 result = new Collection4();
IEnumerator it = map.GetEnumerator();
while (it.MoveNext())
{
DictionaryEntry entry = (DictionaryEntry)it.Current;
result.Add(entry.Key);
result.Add(entry.Value);
}
return result.GetEnumerator();
}
示例5: CacheDirty
internal virtual void CacheDirty(Collection4 col)
{
if (!BitIsTrue(Const4.CachedDirty))
{
BitTrue(Const4.CachedDirty);
col.Add(this);
}
}
示例6: ExcludingReflector
public ExcludingReflector(Type[] excludedClasses)
{
_excludedClasses = new Collection4();
for (var claxxIndex = 0; claxxIndex < excludedClasses.Length; ++claxxIndex)
{
var claxx = excludedClasses[claxxIndex];
_excludedClasses.Add(claxx.FullName);
}
}
示例7: ExcludingReflector
public ExcludingReflector(ByRef loaderClass, Type[] excludedClasses)
{
_excludedClasses = new Collection4();
for (int claxxIndex = 0; claxxIndex < excludedClasses.Length; ++claxxIndex)
{
Type claxx = excludedClasses[claxxIndex];
_excludedClasses.Add(claxx.FullName);
}
}
示例8: Copy
private Collection4 Copy(IEnumerable subject)
{
Collection4 result = new Collection4();
IEnumerator it = subject.GetEnumerator();
while (it.MoveNext())
{
result.Add(it.Current);
}
return result;
}
示例9: DeepClone
public virtual object DeepClone(object newParent)
{
var col = new Collection4
();
object element = null;
var i = InternalIterator();
while (i.MoveNext())
{
element = i.Current;
if (element is IDeepClone)
{
col.Add(((IDeepClone) element).DeepClone(newParent));
}
else
{
col.Add(element);
}
}
return col;
}
示例10: CreateDatabase
private void CreateDatabase(string fileName)
{
IObjectContainer db = Db4oEmbedded.OpenFile(Config(), fileName);
var removed = new Collection4();
for (var idx = 0; idx < NumItemsPerClass; idx++)
{
var itemA = new ItemA(idx);
var itemB = new ItemB(FillStr
('x', idx));
db.Store(itemA);
db.Store(itemB);
if ((idx%DeleteRatio) == 0)
{
removed.Add(itemA);
removed.Add(itemB);
}
}
db.Commit();
DeleteAndReadd(db, removed);
db.Close();
}
示例11: ObjectsChangedSinceLastReplication
public virtual IObjectSet ObjectsChangedSinceLastReplication(Type clazz)
{
Collection4 result = new Collection4();
for (IEnumerator iterator = StoredObjectsCollection(clazz).GetEnumerator(); iterator
.MoveNext(); )
{
object candidate = iterator.Current;
if (WasChangedSinceLastReplication(candidate))
{
result.Add(candidate);
}
}
return new ObjectSetCollection4Facade(result);
}
示例12: CollectKnownClass
private void CollectKnownClass(Collection4 classes, IReflectClass clazz)
{
if (IsInternalClass(clazz))
{
return;
}
if (!HasIdentity(clazz))
{
return;
}
if (clazz.IsArray())
{
return;
}
classes.Add(clazz);
}
示例13: ToArray
public virtual IConstraint[] ToArray()
{
lock (_cluster)
{
Collection4 all = new Collection4();
for (int i = 0; i < _constraints.Length; i++)
{
ClusterConstraint c = (ClusterConstraint)_constraints[i];
for (int j = 0; j < c._constraints.Length; j++)
{
all.Add(c._constraints[j]);
}
}
IConstraint[] res = new IConstraint[all.Size()];
all.ToArray(res);
return res;
}
}
示例14: 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());
}
示例15: 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;
}