1.集合
public static void Show(List<string> names)
{
if (names == null && names.Count < 1)
{
Console.WriteLine("集合中没有数据,输出失败!!!");
}
Console.WriteLine(names[0]);
}
public static void Test()
{
List<string> names = new List<string>();
Show(names);
}
索引超出范围。必须为非负值并小于集合大小。
参数名: index
在 System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
在 System.Collections.Generic.List`1.get_Item(Int32 index)
在 xxx.xxxx.xxx.xxx(xxx xxx) 位置 xxx.xxx.xxx.cs:行号 30
2.异常
Exception tempEx = null;
while ((tempEx = ex.InnerException) != null)
{
exceptions.Add(tempEx);
}
引发类型为“System.OutOfMemoryException”的异常。
在 System.Collections.Generic.List`1.set_Capacity(Int32 value)
在 System.Collections.Generic.List`1.EnsureCapacity(Int32 min)
在 System.Collections.Generic.List`1.Add(T item)
在 xxx.xxxx.xxx.xxx(xxx xxx) 位置 xxx.xxx.xxx.cs:行号 30