Link to home
Start Free TrialLog in
Avatar of Tom Knowlton
Tom KnowltonFlag for United States of America

asked on

Where "m" comes from? MVC

Using MVC:

 <div class="editor-label">@Html.LabelFor(m => m.date_received)</div>
                <div class="editor-field">@Html.TextBoxFor(m => m.date_received)</div>
           

just wondering where "m" comes from?

I don't see it declared anywhere.

And...is this LINQ or some kind of funky MVC syntax?
Avatar of kaufmed
kaufmed
Flag of United States of America image

"m => m.date_received" is a lambda expression. Basically, it is a function without a name. In this case, the function takes one parameter (represented by "m"), and the function returns the date_received of each object in the collection being iterated. The type of "m" is inferred by the compiler.

Lambdas are often used as a part of Linq, but they themselves are not Linq.
Avatar of Tom Knowlton

ASKER

so I could use any letter there, or does it have to be "m"?
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great job on this answer.

Thank you!