Solved

Where "m" comes from?  MVC

Posted on 2012-04-04
4
226 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 75

Expert Comment

by:käµfm³d 👽
ID: 37809173
"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
ID: 37811969
so I could use any letter there, or does it have to be "m"?
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 37812045
"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
ID: 37812233
Great job on this answer.

Thank you!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
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:…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

19 Experts available now in Live!

Get 1:1 Help Now