【问题标题】:ASP.NET MVC View Code Formatting - braces <% } %>ASP.NET MVC 查看代码格式 - 大括号 <% } %>
【发布时间】:2010-12-20 07:12:18
【问题描述】:

有谁知道如何配置 Visual Studio 以正确格式化视图中的代码段

这让我很恼火!:

<select>
<%
foreach(Height height in ViewData.Model.Heights)
{%>
<option value="<%=height.ID %>"><%=height.Value%></option>
<%
}%>
</select>

应该是这样的:

<% foreach(Height height in ViewData.Model.Heights) { %>
    <option value="<%=height.ID %>"><%=height.Value%></option>
<% } %>
</select>

我可以手动修复它,但每当我重新格式化或更改靠近大括号的一些代码时,它又会搞砸!

【问题讨论】:

标签: visual-studio formatting code-formatting


【解决方案1】:

在自动格式化发生后,点击 cntrl-z,它只会撤消自动格式化,不会重新排列你的代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-31
    • 1970-01-01
    • 1970-01-01
    • 2010-12-27
    相关资源
    最近更新 更多