Reputation: 1692
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
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