I have the following two methods, and the last one throws an InvalidCastOperationException, I cannot see what is wrong.
public static ArrayList GetEmployeesArrayList()
{
ArrayList al = new ArrayList();
// do some work here...
return (al);
}
public static Employee[] GetEmployeeArray()
{
return ((Employee[])GetEmployeesArrayList().ToArray()); <-- Throws invalid cast exception (Cannot cast Employee[] from Object...
}