本文整理汇总了C#中RawList.RemoveRange方法的典型用法代码示例。如果您正苦于以下问题:C# RawList.RemoveRange方法的具体用法?C# RawList.RemoveRange怎么用?C# RawList.RemoveRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RawList
的用法示例。
在下文中一共展示了RawList.RemoveRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveResetsReferenceTypesToDefault
[Test] public void RemoveResetsReferenceTypesToDefault()
{
RawList<string> list = new RawList<string>(Enumerable.Range(0, 10).Select(i => i.ToString()));
// Is the internal array empty if not assigned otherwise?
if (list.Capacity > list.Count)
Assert.AreSame(null, list.Data[list.Count]);
// Adjusting the count shouldn't affect the internal array, just as documented
list.Count = 0;
for (int i = 0; i < 10; i++)
{
Assert.AreNotSame(null, list.Data[i]);
}
list.Count = 10;
// Check various types of removal and make sure the internal array is reset properly
{
// Remove an element
list.Remove("1");
Assert.AreSame(null, list.Data[list.Count]);
list.RemoveAt(5);
Assert.AreSame(null, list.Data[list.Count]);
// Remove a range
list.RemoveRange(0, 5);
for (int i = list.Count; i < list.Data.Length; i++)
{
Assert.AreSame(null, list.Data[i]);
}
// Clear the list
list.Clear();
for (int i = list.Count; i < list.Data.Length; i++)
{
Assert.AreSame(null, list.Data[i]);
}
}
}