In C# projects, we frequently group small and tightly related classes into the same .cs
file. This practice reduces the friction of dealing with a myriad of files containing close to no actual code. Yet, is there an established practice to name the file that contains multiple classes?
C# – What naming convention for C# file that contains multiple classes
cnet
Related Topic
- C# File Structure – Best Way to Name Files Containing Generic Classes
- C# – Advantages of Using .dll Files Over Linking .cs Files
- Code First Approach – Business Classes Validation
- C# .NET MVVM – Software Architecture and Naming Conventions
- C# Microservices – Benefits of Multiple Projects Over Namespaces in a Solution
Best Answer
My advice: avoid files containing multiple classes and name files==classes even if you mean there are too many files. Try to organize them in folders. In very special cases you might have nested classes. In this case it makes sense separating the main class and a nested class into different files having one partial class. In this case I use following naming convention.
Probably you can also use multipart file names in your case.