i have function, which has to accept two types of data – Observable collection of MyClass and two dimensional array of myclass. Structure doesnt matter, because i use linq query on these collection. Like – give me all items in collection where Myclass.Value == 3.
So i created function, which accepts parameter of type IEnumerable<MyClass>, since both two dimensional array and observable collections implement IEnumerable and it should work.
However, when i try to pass parameter of type MyClass[,] to my function, compile time error occurs – Argument type Myclass[,] is not assignable to parameter type IEnumerable<MyClass>.
What is wrong? thank you.
Rectangular arrays do implement
IEnumerable, but they don’t implementIEnumerable<T>(for anyT, including the obvious element type). You can fix this easily with a call toCast: