Visual studio displays similar CS files together.
In vs, a new Form will generate three files from1.cs and form1.designer. cs. The designer file is placed at the next level of the first file, which looks very clear about the file structure. In practical applications, we often split a class into several files to ensure that the files are not too long, but these files are arranged in order, which will increase the number of files, not conducive to reading.
Folding Method:
1. Find the <Project Name>. csproj file in the project folder and open it in a text editor.
2. Find <Compile Include = "MyClass. part1.cs"/>,
Change
<Compile Include = "MyClass. part1.cs">
<DependentUpon> MyClass. cs </DependentUpon>
</Compile>
, Modify part2 in the same way
3. Save the file and re-open the project.
You will find that the three MyClass files have been folded together.