当前位置: 首页>>代码示例>>C#>>正文


C# Collection4.Add方法代码示例

本文整理汇总了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));
 }
开发者ID:masroore,项目名称:db4o,代码行数:26,代码来源:Collection4TestCase.cs

示例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;
		}
开发者ID:Galigator,项目名称:db4o,代码行数:10,代码来源:CompositeIterator4TestCase.cs

示例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));
		}
开发者ID:Galigator,项目名称:db4o,代码行数:11,代码来源:Collection4TestCase.cs

示例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();
		}
开发者ID:superyfwy,项目名称:db4o,代码行数:13,代码来源:MapHandler.cs

示例5: CacheDirty

		internal virtual void CacheDirty(Collection4 col)
		{
			if (!BitIsTrue(Const4.CachedDirty))
			{
				BitTrue(Const4.CachedDirty);
				col.Add(this);
			}
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:8,代码来源:PersistentBase.cs

示例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);
     }
 }
开发者ID:masroore,项目名称:db4o,代码行数:9,代码来源:ExcludingReflector.cs

示例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);
			}
		}
开发者ID:Galigator,项目名称:db4o,代码行数:9,代码来源:ExcludingReflector.cs

示例8: Copy

		private Collection4 Copy(IEnumerable subject)
		{
			Collection4 result = new Collection4();
			IEnumerator it = subject.GetEnumerator();
			while (it.MoveNext())
			{
				result.Add(it.Current);
			}
			return result;
		}
开发者ID:Galigator,项目名称:db4o,代码行数:10,代码来源:CollectionHandlerImpl.cs

示例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;
 }
开发者ID:masroore,项目名称:db4o,代码行数:20,代码来源:Collection4.cs

示例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();
 }
开发者ID:masroore,项目名称:db4o,代码行数:21,代码来源:RepeatDeleteReaddTestCase.cs

示例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);
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:14,代码来源:TransientReplicationProvider.cs

示例12: CollectKnownClass

 private void CollectKnownClass(Collection4 classes, IReflectClass clazz)
 {
     if (IsInternalClass(clazz))
     {
         return;
     }
     if (!HasIdentity(clazz))
     {
         return;
     }
     if (clazz.IsArray())
     {
         return;
     }
     classes.Add(clazz);
 }
开发者ID:masroore,项目名称:db4o,代码行数:16,代码来源:KnownClassesCollector.cs

示例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;
			}
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:18,代码来源:ClusterConstraints.cs

示例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());
		}
开发者ID:superyfwy,项目名称:db4o,代码行数:18,代码来源:IteratorAssert.cs

示例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;
 }
开发者ID:masroore,项目名称:db4o,代码行数:19,代码来源:BTreeIteratorTestCase.cs


注:本文中的Db4objects.Db4o.Foundation.Collection4.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。