You need to implement IEnumerable (or something like this) .