Solved

What is this operator, "=>", do in Asp.net MVC?

Posted on 2014-11-09
2
578 Views
Last Modified: 2014-11-09
@Html.DisplayFor(modelItem => item.TableNum)
Trying to learn MVC, what is this code doing?

Thank you,
0
Comment
Question by:lapucca
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40431774
It introduces a lambda expression, which is kind of like an anonymous function--or a function that you don't give a name to. Lamda's are useful in scenarios where you have logic that depends on being passed a behavior rather than a piece of data. When I say "behavior," I basically mean a piece of functionality.

In your case, your lamda effectively passes the value of what is in the TableNum property to the DisplayFor method. The end result is that a <label> is spit out into your HTML for the data that TableNum holds.
0
 

Author Closing Comment

by:lapucca
ID: 40431864
Thank you
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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