C
CSharper
I have the following code
ArrayList list = new ArrayList();
foreach (string name in FilesNames())
{
list.Add(name);
}
return list.ToArray();
which basically calls FileNames() method which yeild a string for each
call. It works file. The objective of this method to return an
object[] back so that it can be used to add it into the listview.
Adding the list view also works correct.
My question, is there a better way of doing this?
return FileNames().ToArray<object>(); ???
I thought it might work but the convertion from IEnumeration to
ICollection doesn't work, what is the best way of doing it?
Thanks.
ArrayList list = new ArrayList();
foreach (string name in FilesNames())
{
list.Add(name);
}
return list.ToArray();
which basically calls FileNames() method which yeild a string for each
call. It works file. The objective of this method to return an
object[] back so that it can be used to add it into the listview.
Adding the list view also works correct.
My question, is there a better way of doing this?
return FileNames().ToArray<object>(); ???
I thought it might work but the convertion from IEnumeration to
ICollection doesn't work, what is the best way of doing it?
Thanks.