When using variables of which their plural and singular are both the same, how do you name them? Are there any standards out there?

For example:

Series[] series  // Plural
Series series    // Singular


To be specific, my collection of series needs to be called series (due to JSON formatting), would you consider naming the singular form of Series that gets added to the collection Series s?

As in:

List<Series> series = new List<Series>();
Series s;

while (someBool)
    s = new Series();
    s.Name = "Name";
    while (anotherBool)
  • 4
    I usually distinguish them by adding the type of collection they are stored in into their name, such as seriesList, seriesArray or seriesLinkedList. I don't think there's a naming standard. – Andy Sep 24 '15 at 11:18
  • 8
    +1 for pluralia tantum! I guess it depends on what the series is. For instance if it were a television series (I am speculating here) a single element could be an episode - although that does feel a little messy to me. Are there any synonyms that make sense to your model? I once happened across a fairly horrific solution in some code I was maintaining - it would technically work for you: use gollum-speak; e.g: serieses. Not that I am suggesting you do that - definitely not! :D – Darragh Enright Sep 24 '15 at 11:18
  • 3
    @Darragh When talking with my colleagues about the series, the occasional "serieses" does occur when trying to accentuate that we're speaking of the collection ;) – anthonytimmers Sep 24 '15 at 11:24
  • 1
    Since you can't change the name of your list, in that sample, I would call it newSeries – the_lotus Sep 24 '15 at 15:55
  • 1
    Is it an option to call it Series[] serieses, or is that too Gollum-y? – Jules Sep 24 '15 at 17:02

I do not think there is a standard for this. The majority of english nouns does not come with this problem. So if you do not want to add a term like "list" or "collection" to the variable name, a possible solution is to circumvent that problem by simply choosing a different term.

In your example, one could use "sequence" instead of "series" (if that is the meaning of "series" you had in mind).

Of course, for some words like "spectacles" or "trousers" finding an appropriate synonym which fits to your context might not be easy. For those it is probably the best solution to follow @DavidPacker's suggestion to use a word like "spectaclesCollection" or "trousersList".

| improve this answer | |
  • I would avoid naming the trousers trouserList since it could misrepresent the type behind it. Being that C# is tagged in the question I think XxxCollection is better since ICollection is an interface and not a specific implementation. – Ziv Oct 7 '15 at 11:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.