本文整理汇总了C#中ArrayList.View方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.View方法的具体用法?C# ArrayList.View怎么用?C# ArrayList.View使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayList
的用法示例。
在下文中一共展示了ArrayList.View方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChildrenContainsTest
public void ChildrenContainsTest()
{
var l = new ArrayList<double> {0, 1, 2, 3, 4, 5};
IList<double> v1 = l.View(1, 3);
Log.Info(v1.Display());
v1.Add(4.5);
Log.Info(l.Display());
}
示例2: Main
public static void Main(String[] args) {
IList<String> names = new ArrayList<String>();
names.AddAll(new String[] { "Hoover", "Roosevelt",
"Truman", "Eisenhower", "Kennedy" });
// Print list:
Console.WriteLine(names);
// Print item 1 ("Roosevelt") in the list:
Console.WriteLine(names[1]);
// Create a list view comprising post-WW2 presidents:
IList<String> postWWII = names.View(2, 3);
// Print item 2 ("Kennedy") in the view:
Console.WriteLine(postWWII[2]);
// Enumerate and print the list view in reverse chronological order:
foreach (String name in postWWII.Backwards())
Console.WriteLine(name);
}
示例3: Main
public static void Main(String[] args) {
IList<int> list1 = new ArrayList<int>();
list1.AddAll(new int[] { 2, 5, 7, 11, 37 });
IList<int> list2 = new GuardedList<int>(list1);
IList<int>
gv = new GuardedList<int>(list1.View(1,2)),
vg = list2.View(1,2);
IList<int>
gvu = gv.Underlying,
vgu = vg.Underlying;
Console.WriteLine(gvu); // Legal
Console.WriteLine(vgu); // Legal
// gv.Slide(+1); // Illegal: guarded view cannot be slid
vg.Slide(+1); // Legal: view of guarded can be slid
// gvu[1] = 9; // Illegal: list is guarded
// vgu[1] = 9; // Illegal: list is guarded
}