C#中ArrayList INSERT的问题...求助中
来源:百度知道 编辑:UC知道 时间:2024/06/08 05:49:46
资料上说因为index参数的存在,arraylist的insert方法比 add方法多一个可能产生异常,为什么啊?
请讲详细点,好懂些,谢谢^.^
请讲详细点,好懂些,谢谢^.^
Insert方法比Add多的异常是由参数index引起的。当index小于0或大于Count的时候,系统会认为无法插入该项目,引发异常。
以下是两个方法的具体信息。
Insert方法:
参数
index
类型:System..::.Int32
从零开始的索引,应在该位置插入 value。
value
类型:System..::.Object
要插入的 Object。该值可以为 nullNothingnullptrnull 引用(在 Visual Basic 中为 Nothing)。
实现
IList..::.Insert(Int32, Object)
异常
异常 条件
ArgumentOutOfRangeException index 小于零。
- 或 -
index 大于 Count。
NotSupportedException ArrayList 为只读。
- 或 -
ArrayList 具有固定大小。
Add方法:
参数
value
类型:System..::.Object
要添加到 ArrayList 的末尾处的 Object。该值可以为 nullNothingnullptrnull 引用(在 Visual Basic 中为 Nothing)。
返回值
类型:System..::.Int32
ArrayList 索引,已在此处添加了 value。
实现
IList..::.Add(Object)
异常
异常 条件
NotSupportedException ArrayList 为只读。
- 或 -
ArrayList 具有固定大小。
insert 是 使劲往
c#问题 关于ArrayList的
c# 中ArrayList类和集合中的属和方法的用法??? 急急!!!
在C#中,“Array可以有多维,而ArrayList只能是一维”这句话对么?
C# 有关ArrayList 取数据救命啊
一个JAVA中ArrayList的问题
java 中ArrayList 类中如何向其中添加另外一个ArrayList实例后的对象
C#.Net 中ArrayList 与 Array的区别?
JAVA入门问题,ArrayList中如何添加包装数据对象
c#winform怎么随机选取arraylist或数组中数据
c#错误1:找不到类型或命名空间名称“ArrayList”(是否缺少 using 指令或程序集引用?)