MAC 上的 Visual Studio 文件缩进

File indenting in Visual Studio on the MAC

我见过一些应用程序,其中 C# 代码被拆分到不同的文件中,每个文件持有部分 class。据我所知,可以使这些缩进显示在 Mac 的 Visual Studio 中,如本例所示:

file1
   file1.data
   file1.commands
   file1.bindings

谁能告诉我如何实现这种视觉效果

只需在您的 csproj 文件中添加一个 <DependentUpon /> 标签。

<Compile Include="file1.cs" />
<Compile Include="file1.data.cs">
  <DependentUpon>file1.cs</DependentUpon>
</Compile>
<Compile Include="file1.commands.cs">
  <DependentUpon>file1.cs</DependentUpon>
</Compile>
<Compile Include="file1. bindings.cs">
  <DependentUpon>file1.cs</DependentUpon>
</Compile>

我认为在 visual-studio 中没有捷径可以做到这一点,除非你安装了一个扩展;您将必须在文本编辑器中手动编辑 csproj。另外,我认为 Mac 的 VS 还没有可用的插件。

参考文献:

  1. Nesting Files In Visual Studio
  2. Introducing File Nestor for Visual Studio

编辑 1 看起来有一个 nesting add-in(beta) 可用于 MonoDevelop - 这反过来应该与 Mac.

的 VS 兼容