This usually happens when you are missing using System.Linq; at the top of the file.
You will also need to use .NET 3.5 or more for it to work. System.Linq is located in the System.Core.dll assembly, which is included by default in projects using .NET 3.5 or higher.
EDIT
Upon closer inspection, this code will never work as it is written, because the Enumerable.Cast() method is general and requires that you pass in the type that you are executing: for example. mNames.Cast<object>().ToArray();
Bennor mccarthy
source share