-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Summary
Change the return type of methods that return List<> to IEnumerable<>.
Motivation
Manipulating the lists that returns from the methods have no effect on the actual BMesh, as such there is really no reason you ever should or would need to add/remove items to the List<>s. It also does not clearly communicate the purpose and use of the returned collection when it is a List<>.
Where as IEnumerable<> more clearly communicates the intent behind the method.
Returning a List<> does not follow the C# design guidelines. An added benefit of returning IEnumerable<> is that the methods can make uses of yield return for potentially slightly better performance.
Drawbacks
This is a breaking changing if people use any of the List<> methods such as Add() Remove() or Contains(), or for people that declare the variable type when assigning the returned value List<Edge> edges = vertex.NeighborEdges().
Alternatives
One option is to return IReadOnlyList<> instead so people still have access to the indexer and Count property. However this makes it less generic and can no longer use yield return.
I would be happy to make a PR for this change if desired after any further discussion.