Just found this question after looking for what conventions other people use for generic class filenames.
Lately I've been using ClassName[T].cs
. I really like this convention, and I think it's superior to the others for the following reasons:
- The type parameters jump out at you a
little more than they do with the
Microsoft convention (e.g.,
ClassNameOfT.cs
).
- It allows you to have multiple
type parameters without too much
confusion:
Dictionary[TKey,
TValue].cs
- It doesn't require you to create any special folders, or to have your generic classes in a special namespace. If you only have a few generic classes, having a special namespace dedicated to them just isn't practical.
I borrowed this convention from Boo's generic syntax, albeit slightly modified (Boo uses ClassName[of T]
).
Some developers seem to have a phobia of filenames that contain anything but letters and underscores, but once you can get past that this convention seems to work extremely well.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…