Are you sure that the Select method returns an array? Casting + generics = code smell
Try this:
double[] max = data
.Select(crArray => crArray.Select( cr => cr.ValueNorm ).Max())
.ToArray();
Conversion Method - (ToArray) allocates a new array and populates it. Bound by the restrictions of methods.
Down Casting - Allows you to change the type of the reference to an object instance.
Only the actual instance type, or some type that the instance type inherits from are allowed. Anything else gives a runtime exception.
Explicit Conversion Operator - uses the syntax of down casting, to achieve the effect of conversion. It's really a Conversion Method. This is an endless source of confusion for people trying to understand casting.
Consider this code:
// reference type is IEnumerable<string>, instance type is string[]
IEnumerable<string> myArray =
new string[3] { "abc", "def", "ghi" };
// reference type is IEnumerable<string>, instance type is ???
IEnumerable<string> myQuery = myArray
.Select(s => s.Reverse().ToString());
//Cast - works
string[] result = (string[]) myArray;
//Cast - runtime exception: System.InvalidCastException
result = (string[])myQuery;
//Conversion - works
result = myQuery.ToArray();
Why didn't you get a runtime exception in vs? I don't know.