(14-07-16, 09:27 PM)الوادي كتب : استخدمت نفس الكود الخاص بك مع التعديلين اللي انا عدلتهم ولم تظهر مشكلةالمشكلة فى List انه فى Class اخر
PHP كود :
List<int> list1 = new List<int>(new int[]{1, 2, 3, 4, 5, 6});
int Items;
for (int intIdx = 0; intIdx <= list1.Count - 1; intIdx++) {
Items = list1[intIdx];
MessageBox.Show("[test]" + Items.ToString() + "[end]");
//sw.WriteLine("[test]" + Items.ToString() + "[end]");
}
كود :
public class Listx
{
public static List<int> List = new List<int>();
public static void Listclass()
{
List.Add(1);
List.Add(2);
List.Add(3);
List.Add(4);
}يعطينى هذه الخطاء
إقتباس :An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: Index was out of range. Must be non-negative and less than the size of the collection.


