A normal list can be called like this (this is what I learned at school):
List<Object> objects = new List<Object>();
But, how does a list has to be called when the object itselfs ends with a "s".
List<Octopus> octopuss = new List<Octopus>();
List<Boss> bosss = new List<Boss>();
It seems wierd to add another s. Not many (single) words end with "s". So, this is one of the first time I encountered it. Did anyone found a source where this is explained?
EDIT
These words have a plural noun. But what about these:
List<Series> series? = new List<Series>();
List<Species> species? = new List<Species>();
For variables that contain multiple items, it's best to use basic english plurals:
object -> objects
disk -> disks
boss -> bosses
octopus -> octopi OR octopuses
This is where it gets more difficult. You could choose to adopt a separate name for plural and singular like:
You could simply add an 's' or 'es' anyway (not proper english, but may be more clear in code):
series -> serieses
species -> specieses
sheep -> sheeps
You could choose to adopt a standard, like adding Coll or similar to the end of the name:
series -> seriesColl
species -> speciesList
sheep -> sheepSet
Refer: https://www.grammarly.com/blog/plural-nouns/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With