C# for some reason won't recast it as an array of ValueType (thought that would probably work).
No, it won't work because the representation is different.
The reason covariance works for reference type arrays is that the representation of a reference is the same regardless of the type of object it refers to. That's not the case if you compare value types and reference types.
For example, consider:
byte[] x = { 1, 2, 3, 4 };
Each element of x
is just a byte. You can't view that array as an object[]
- each element simply isn't a reference.
However, you can fairly easily convert each element via boxing and create a list that way:
List<Object> list = ((IEnumerable) WorkingHours).Cast<Object>().ToList();