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


C# RawList.Contains方法代码示例

本文整理汇总了C#中RawList.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# RawList.Contains方法的具体用法?C# RawList.Contains怎么用?C# RawList.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RawList的用法示例。


在下文中一共展示了RawList.Contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Basics

		[Test] public void Basics()
		{
			RawList<int> intList = new RawList<int>();
			intList.Add(10);
			intList.AddRange(new int[] { 17, 42, 94 });

			Assert.AreEqual(4, intList.Count);
			Assert.IsTrue(intList.Contains(42));
			Assert.AreEqual(2, intList.IndexOf(42));
			CollectionAssert.AreEqual(new int[] { 10, 17, 42, 94 }, intList);
			CollectionAssert.AreEqual(new int[] { 10, 17, 42, 94 }, intList.Data.Take(4));

			intList.ShrinkToFit();
			Assert.AreEqual(intList.Count, intList.Capacity);

			intList.Remove(42);
			Assert.AreEqual(3, intList.Count);
			Assert.IsTrue(!intList.Contains(42));
			Assert.AreEqual(-1, intList.IndexOf(42));
			CollectionAssert.AreEqual(new int[] { 10, 17, 94 }, intList);
			CollectionAssert.AreEqual(new int[] { 10, 17, 94 }, intList.Data.Take(3));

			intList.Insert(1, 100);
			CollectionAssert.AreEqual(new int[] { 10, 100, 17, 94 }, intList);
			CollectionAssert.AreEqual(new int[] { 10, 100, 17, 94 }, intList.Data.Take(4));

			intList.InsertRange(2, new int[] { 150, 200, 250, 300 });
			CollectionAssert.AreEqual(new int[] { 10, 100, 150, 200, 250, 300, 17, 94 }, intList);
			CollectionAssert.AreEqual(new int[] { 10, 100, 150, 200, 250, 300, 17, 94 }, intList.Data.Take(8));

			intList.Clear();
			Assert.AreEqual(0, intList.Count);
			Assert.IsTrue(!intList.Contains(94));
		}
开发者ID:KSLcom,项目名称:duality,代码行数:34,代码来源:RawListTest.cs

示例2: CollectInvolvedEntities

 /// <summary>
 /// Collects the entities which are affected by the solver group and updates the internal listing.
 /// </summary>
 protected internal override void CollectInvolvedEntities(RawList<Entity> outputInvolvedEntities)
 {
     foreach (EntitySolverUpdateable item in solverUpdateables)
     {
         for (int i = 0; i < item.involvedEntities.count; i++)
         {
             if (!outputInvolvedEntities.Contains(item.involvedEntities.Elements[i]))
             {
                 outputInvolvedEntities.Add(item.involvedEntities.Elements[i]);
             }
         }
     }
 }
开发者ID:VICOGameStudio-Ujen,项目名称:igf,代码行数:16,代码来源:SolverGroup.cs

示例3: CollectInvolvedEntities

 /// <summary>
 /// Adds entities associated with the solver item to the involved entities list.
 /// Ensure that sortInvolvedEntities() is called at the end of the function.
 /// This allows the non-batched multithreading system to lock properly.
 /// </summary>
 protected internal override void CollectInvolvedEntities(RawList<Entity> outputInvolvedEntities)
 {
     outputInvolvedEntities.Add(Body);
     foreach (Wheel wheel in Wheels)
     {
         if (wheel.supportingEntity != null && !outputInvolvedEntities.Contains(wheel.supportingEntity))
             outputInvolvedEntities.Add(wheel.supportingEntity);
     }
 }
开发者ID:rc183,项目名称:igf,代码行数:14,代码来源:Vehicle.cs


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