Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Where "m" comes from?  MVC

Posted on 2012-04-04
4
Medium Priority
?
232 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:Tom 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:Tom 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 2000 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:Tom Knowlton
ID: 37812233
Great job on this answer.

Thank you!
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

877 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