Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Partial Class - Visual Studio 2008

Is there a possibility to create partial classes that are grouped in the Solution Explorer like VS does it with code behind classes (eg. Default.aspx and Default.aspx.cs).

I would like to create MyClass.cs and MyClass.partial.cs and they should not be shown as 2 seperate files in the Solution explorer.

like image 602
chbu Avatar asked Dec 08 '22 08:12

chbu


1 Answers

I've not seen a way to do this within Visual Studio itself, but it is possible to do it by editing the .csproj file. You need to find the place where the file you want to show up under the other file is in the proj file and add a element with the content set to the name of the file you want to be dependent upon.

example:

<Compile Include="MyFile.g.cs">
    <DependentUpon>MyFile.cs</DependentUpon>
</Compile>
like image 164
dustyburwell Avatar answered Jan 08 '23 23:01

dustyburwell