Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the "=>" mean?

Tags:

c#

I've got a pretty noob question for ya. I keep seeing this syntax:

<%= Html.LabelFor(model => model.Email) %>

...and I have no idea what the => means. I thought it was syntax for linq2sql or ado.net entity framework but I'm just using straight ado.net. I don't understand why the VWD used that syntax when generating the Create form.

What does => mean?

like image 433
quakkels Avatar asked Feb 18 '26 22:02

quakkels


2 Answers

it is a lambda expression it means "goes to"

this is a pretty good link for explaining here

the left side is the input the right side the expression or statement block, here you are calling the LabelFor method inputing model and using the Email field on the model passed in.

like image 130
Pharabus Avatar answered Feb 21 '26 11:02

Pharabus


Take a look at Lambda Expressions (C# Programming Guide)

All lambda expressions use the lambda operator =>, which is read as "goes to". The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression or statement block. The lambda expression x => x * x is read "x goes to x times x."

like image 22
SQLMenace Avatar answered Feb 21 '26 12:02

SQLMenace



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!