Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PrintingFoundIt(Almost!(Damn!)) 1 27
mail.To.Add 5 26
C# Desktop Application 3 35
transaction in asp.net, sql server 6 33
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

778 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