A List<T>
is an IEnumerable<T>
, so actually, there's no need to 'convert' a List<T>
to an IEnumerable<T>
.
Since a List<T>
is an IEnumerable<T>
, you can simply assign a List<T>
to a variable of type IEnumerable<T>
.
The other way around, not every IEnumerable<T>
is a List<T>
offcourse, so then you'll have to call the ToList()
member method of the IEnumerable<T>
.