C# style code in Razor syntax

May 27, 2012 at 10:51 AM

Should we follow the StyleCop rules in the Razor syntax?

For example use this:

<span>@this.Model.Name</span>
<span>@this.Html.DisplayFor(model => model.Name)</span>

Instead of

<span>@Model.Name</span>
<span>@Html.DisplayFor(model => model.Name)</span>

And does or will StyleCop check the Razor files (cshtml).

Coordinator
May 27, 2012 at 11:13 AM
Up to you.

Stylecop only checks files ending .cs ; until someone writes a parser for any other file type.


~A.

On 27 May 2012, at 11:52, amirkarimi <notifications@codeplex.com> wrote:

From: amirkarimi

Should we follow the StyleCop rules in the Razor syntax?

For example use this:

@this.Model.Name
@this.Html.DisplayFor(model => model.Name)

Instead of

@Model.Name
@Html.DisplayFor(model => model.Name)

And does or will StyleCop check the Razor files (cshtml).

May 27, 2012 at 11:59 AM

And what is your offer? To follow the StyleCop rules in Razor or not?