本文整理汇总了C#中System.Collections.ArrayList.SubList方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ArrayList.SubList方法的具体用法?C# System.Collections.ArrayList.SubList怎么用?C# System.Collections.ArrayList.SubList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ArrayList
的用法示例。
在下文中一共展示了System.Collections.ArrayList.SubList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSubListJava
public virtual void TestSubListJava()
{
System.Collections.IList l = new System.Collections.ArrayList();
l.Add("param1");
l.Add("param2");
l.Add("param3");
l.Add("param4");
int fromIndex = 1;
int size = 2;
int endIndex = fromIndex + size;
System.Collections.IList l2 = l.SubList(fromIndex, endIndex);
AssertEquals(2, l2.Count);
}
示例2: TestSubListJava3
public virtual void TestSubListJava3()
{
System.Collections.IList l = new System.Collections.ArrayList();
int fromIndex = 100;
int size = 20;
int endIndex = fromIndex + size;
bool throwException = false;
if (!throwException)
{
if (fromIndex > l.Count - 1)
{
fromIndex = 0;
}
if (endIndex > l.Count)
{
endIndex = l.Count;
}
}
System.Collections.IList l2 = l.SubList(fromIndex, endIndex);
AssertEquals(0, l2.Count);
}
示例3: TestSubListJava2
public virtual void TestSubListJava2()
{
System.Collections.IList l = new System.Collections.ArrayList();
l.Add("param1");
l.Add("param2");
l.Add("param3");
l.Add("param4");
int fromIndex = 1;
int size = 20;
int endIndex = fromIndex + size;
bool throwException = false;
if (!throwException)
{
if (endIndex > l.Count)
{
endIndex = l.Count;
}
}
System.Collections.IList l2 = l.SubList(fromIndex, endIndex);
AssertEquals(3, l2.Count);
}