dan_l
dan_l

Reputation: 1692

asp.net razor colon operator

I was reading about asp.net mvc 3 and saw this piece razor view code

<div id="footer">
    @RenderSection("footer", required:false)
    @if(IsSectionDefined("Copyright"))
    {
        @RenderSection("copyright")
    }
        else
    {
        <hr /><span>Rights reserved for a better use.</span>
    }
    @this.RenderSection("Privacy", @<u>Privacy policy</u>)
</div>

What is that colon in "required:false" ? Is that a new C# operator ?

Upvotes: 3

Views: 795

Answers (2)

Tx3
Tx3

Reputation: 6916

Feature is called named argument

Upvotes: 2

Darin Dimitrov
Darin Dimitrov

Reputation: 1038720

It's a named parameter. Optional and named parameters were introduced in C# 4.0. Nothing to do with ASP.NET, ASP.NET MVC or Razor.

Upvotes: 7

Related Questions