المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : array help please



C# Programming
11-06-2009, 06:41 PM
Sorry, I'm new to C# so please forgive the ignorance...

I have a list, and want to make another list from the first list:

int[] list1 = { 1, 3, 5, 7, 9 };
int[,] list2;

for (int i = 0; i < list1.Length; i++)
{
list2[i] = [item from list1] , [i];
}

How do i put items in list2? I'm looking for:
{{1,0} {3,2} {5,3} {7,4} {9,5}}

Thank you for your time.