Solved

Where "m" comes from?  MVC

Posted on 2012-04-04
4
225 Views
Last Modified: 2012-04-05
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?
0
Comment
Question by:knowlton
  • 2
  • 2
4 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
"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.
0
 
LVL 5

Author Comment

by:knowlton
Comment Utility
so I could use any letter there, or does it have to be "m"?
0
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
"m" in this case is a variable, which means it can be any arbitrary name--so long as you haven't already defined a variable with that name within the same scope as the lambda.
0
 
LVL 5

Author Closing Comment

by:knowlton
Comment Utility
Great job on this answer.

Thank you!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now