0

I am vb.net familiar. Have a razor c# piece of code. Went through pages of documentation but I cannot find out what does this code do?

<li class="@Html.IsSelected(controller: "Dashboards")>

I understand that runs function IsSelected of Html class but what is the meaning of argument passed to it?

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
Megrez7
  • 1,423
  • 1
  • 15
  • 35

1 Answers1

1

if I understood correctly you want to under stand what this does

 @Html.IsSelected(controller: "Dashboards")

@ tells razor to output the following to the html code by executing

Html.IsSelected

the parameter is a Named or optional parameter. It is basically saying sets the value of parameter with name "controller" to "Dashboards"

The function's definition might be like

IsSelected(int notUsed = 0, string notUsed2 = null, string controller = "dead beef")

so that you can save yourself some typing instead calling IsSelected(0, null, "Dashboards")

Steve
  • 11,696
  • 7
  • 43
  • 81