This question is a bit opinionated, but I wanted some input. I have two static methods for creating ranges within a list. I can define a range in terms of a start and stop index or in terms of an index and a count. Here are the names I have so far:
public static Range FromStartAndStopIndex(int startIndex, int stopIndex);
public static Range FromIndexAndCount(int startIndex, int count);
I think these names are too long, but at least there’s no ambiguity. I am sure there are other libraries out there that define ranges within a list. I am curious what names they have used to define ranges in different ways.
.NET tends to use index and count. For example:
String.SubstringEnumerable.RangeStream.ReadArray.CopyArraySegment<T>I would go with this, and only support the one model. Aside from anything else, when you’ve got an “end” parameter you then need to say whether it’s inclusive or exclusive. (It should almost always be exclusive, but it’s something else to clarify.)
On the other hand,
SortedSet.GetViewBetweennecessarily takes lower and upper bounds. That’s somewhat different though.