Naming Conventions For Partial Class Files

I use . separation – for example EmployeeController.SomeSpecialBehaviour.cs. I also link it into the project tree via “dependentUpon” or whatever it is in the csproj, so that it nests under the file (in solution explorer) neatly. You have to do that by hand (edit the csproj) or with an addin, though; for example:

<Compile Include="Subfolder/Program.cs" />
<Compile Include="Subfolder/Program.Foo.cs">
  <DependentUpon>Program.cs</DependentUpon> <!-- Note that I do not reference the subfolder here -->
</Compile>

appears as:

  • Subfolder
    • Program.cs
      • Program.Foo.cs

Leave a Comment