0

我正在尝试使用 Resharper 的带有模式/结构替换功能的搜索来查找如下所示的 (cs)html 片段,最终目标是用编辑器模板替换所述代码:

<div class="editor-label">
@Html.LabelFor(model => model.FirstName)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.FirstName, new { @class = "text" })
@Html.ValidationMessageFor(model => model.FirstName)
</div>

我正在使用以下模式,但我收到一条错误消息,指出无法解析搜索模式:

@Html.LabelFor(model => model.$propertyName$)
<div class="editor-label">
@Html.LabelFor(model => model.$propertyName$)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.$propertyName$, new { @class = "text" })
@Html.ValidationMessageFor(model => model.$propertyName$)
</div>

谁能告诉我:

  • 如果我做错了什么
  • 如果 Resharper 的模式功能能够处理 HTML
  • 如果 Resharper 的模式功能能够处理多行模式

提前致谢

J.P

4

1 回答 1

1

ReSharper 6.0 doesn't support SSR in HTML, but 6.1 will. But still, only plain HTML (in html, aspx, cshtml files), but not Razor constructions, like @Html. So, your pattern will not work even in 6.1.

P.S. Yes, ReSharper is capable of handling multiline patterns.

于 2011-09-05T19:42:57.900 回答