Let's say I have a datagrid with itemsource binded to property Collection, which is for example IEnumerable. Of course I wrote appropriate getter and setter for it.
Now, when I assign to this property (Collection) just IEnumerable (as the result of some method), like:
Collection = FooMethod(); // FooMethod returns IEnumerable<MyClass>
datagrid will display empty rows. The count of the rows will match the count of the Collection.
But when I force conversion, like this:
Collection = FooMethodp().ToArray(); // forced fetching data
datagrid will show all rows with content now.
So what stops datagrid from showing data in case of pure IEnumerable? It has to iterate over a collection so fetching occurs anyway.
edits
Just for the record. MyClass is this:
public class ErrorsIndicators
{
public double Min { get; set; }
public double Max { get; set; }
public double Avg { get; set; }
}
and FooMethod returns (return yield) several items. So, nothing fancy here.