I am having a bit of trouble getting this c# code to work I can get it to work if I use the console.write that I have commented out but I can get those same results stored in this array for me to use in a different section of my program.
FileInfo[] selectionFileOrder;
for (int index = 0; index < dateAllOrder.Length; index++)
{
if (dateAllOrder[index].LastAccessTime.Month == DateTime.Now.Month)
{
int i = 0;
i++;
selectionFileOrder[i] = dateAllOrder[index];
// Console.Write("{1}. {0}", dateAllOrder[index].Name, index);
// Console.Write(" ({0}) ", dateAllOrder[index].Length);
Console.WriteLine();
}
}
I have looked at google and can’t seem to find any answers to my issue I know that it is the variable selectionFileOrder that is unsigned but I don’t have anything to assign to it. Any fresh ideas would be helpful
Thanks
You need to initialize the array:
or better, use a List:
Or best, use LINQ!