Say I have a datagrid with an itemsource tied to a Collection property, which, for example, is IEnumerable. Of course, I wrote a suitable getter and setter for this.
Now, when I assign this property (Collection) to just IEnumerable (as the result of some method), for example:
Collection = FooMethod(); // FooMethod returns IEnumerable<MyClass>
datagrid will display empty rows. The number of rows will correspond to the number of collections.
But when I force the conversion, like this:
Collection = FooMethodp().ToArray(); // forced fetching data
datagrid will show all rows with content.
So, what stops a datagrid from displaying data in the event of a pure IEnumerable? He must iterate over the collection, so sampling happens anyway.
edits
For recording only. MyClass:
public class ErrorsIndicators
{
public double Min { get; set; }
public double Max { get; set; }
public double Avg { get; set; }
}
and FooMethod returns (return) several elements. So, nothing out of the ordinary here.