本文整理汇总了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));
}
示例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]);
}
}
}
}
示例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);
}
}