I am getting the error:
‘string[]’ does not contain a definition for ‘Cast’ and no extension method ‘Cast’ accepting a first argument of type ‘string[]’ could be found (are you missing a using directive or an assembly reference?)
on the following piece of code:
return mNames.Cast().ToArray();
What using directive or assembly reference do I need?
How do I find out such things?
I’m a noob at C# and .NET, I’m just copying code to get a job done, so don’t get too technical with me.
(1) Make sure you are working on C# 3.0+
(2) Make sure your code contains:
(3)
.Castis a generic method, you need to specify the type parameter, like this: