在vs中,新增一个Form 会对应生成三个文件from1.cs、form1.designer.cs,其中designer文件是放在第一个文件的下一级的,这样看起来文件的结构非常清楚。实际应用中,我们也经常会把一个类折分成几个文件来编写,以确保文件不会过长,但这些文件顺序排列起来,会使文件变得非常的多,不利于阅读。
JSPig5uuTEhRprYe0gSr3SKkBaA0MAq2BQaA1MAi0BgaB1sAg0BoYRJHWyCEAY6FIa2THgLFQpPUK2TFruKT6J7kOdGk9R3ZM9DXMYp7rRpfWDtkxY1zD8PEmoE5rh+wYpgLtxFvonVLnle81Q/2o0xrZMeF+qNnhziVOd845O3RpjeyYVrfewB+YEvc0k4zVa4bK0aU1smO4foQxNTC3zrF63aUcRVojO4YbyzsiF1C9Q3c+GcIzzA5FWgudnoyED2q+PilBkdZ6SBuoco+UGoDWwCDQGhgEWgODQGtgEGgNDAKtgUEUaY0cAjAWirRGdgwYC0Var5Jmx+ATEEvo0nqeIjvG2dqTCZw2rV2K7BgHrc2hTms3eXaMY7awObI5RLKrLtxKvuCxt6tuStRpPX12jOO3hnrrhA/Crei/4fngv5Fh6NI6SXaM67nrPxC/vfK1ArnrozXtZxotckeX1kmyY9xQrQe0itG68y5Qo0jrhNkx3tVw58rEu6TmWnEx2wliPB0LhFGktdBpPXQuP0AqFGmdI4igOoHWwCDQGhgEWgODQGtgEGgNDAKtgUGgNTAItAYGgdbAINAaGARaA4NAa2AQaA0MAq2BQaA1MAi0BgaB1sAg0BoYBFoDg0BrYBBoDQzyL11iw8LFrfUNAAAAAElFTkSuQmCC" alt="" />
折叠方法:
1. 在项目文件夹中找到 <项目名>.csproj 文件,用文本编辑器打开
2. 找到 <Compile Include="MyClass.part1.cs" /> ,
修改为
<Compile Include="MyClass.part1.cs" >
<DependentUpon>MyClass.cs</DependentUpon>
</Compile>
,相同方法修改part2
3. 保存文件,重新打开工程。
你会发现MyClass 三个文件已经折叠在一起了.
QQaDR34GYRBeCXsRtBASDOR6pa3Wwn4CLQJeDVlopyz8BMNgJDCaJ3AWjZtOn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