Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2014-11-09
2
568 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

838 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