Solved

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

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

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
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
Comment Utility
Thank you
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

8 Experts available now in Live!

Get 1:1 Help Now