I'm currently studying asp.net mvc and I just started, I decided to move away from web forms to mvc.
I understand the basics of linq and lambdas but I would just like to know or get a good explanation about this particular syntax.
@model IEnumerable<CodeplexMvcMusicStore.Models.Album>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Genre.Name)
</td>
I would just like to know what is the meaning of modelItem => item.Genre.Name
My knowledge on this is that modelItem
gets the value item.Genre.Name
and then it is passed method Html.DisplayFor()
.
I'm also curious about how do I write the same code without using lambda.
Correct me if I'm wrong I would just like to know the meaning of the code and how it is read.