System.Linq.Enumerable.WhereSelectListIterator<TSource, TResult>
does implement IEnumerable<TResult>
and, as you already know, it is not serializable.
WhereSelectListIterator
stores the source and query definition, and allows your query to be lazy, what means it's evaluated when you need the results, not when the query is created.
If you want to serialize results of the query, you have to force the evaluation. Either ToList()
or ToArray
will work just fine.
data.Save("ships", this.ships.Select(x => x.Name).ToList());
To make sure that kind of error does not occur in future, you can consider changing Save
method definition to use ICollection<T>
instead of IEnumerable<T>
.