I decided to ask this question here instead of on stack overflow because it is rather subjective.
In C#, typically I see generic types with very poor names. Specifically, "T" is commonly used but is not a meaningful name by itself. For example:
class Fruit<T>
{
T fruit;
}
While this is the typical approach, would anyone recommend against this? And if so, what would a reasonable naming convention be for generic types in the context of C# for generic functions and classes?
In my previous example, let's assume that generic type T
must always be a type of fruit, such as Apple
or Orange
. The type T
needs to make it obvious that it's a type of fruit, so maybe a better name would be FruitType
, so we end up with:
class Fruit<FruitType>
{
FruitType fruit;
}
This is just to give you guys an idea of what I'm looking for. What's an acceptable "rule of thumb" for this issue?