Understand C# LAMBDA Expressions in only 2 minutes!

  Рет қаралды 64,798

tutorialsEU - C#

tutorialsEU - C#

Күн бұрын

Пікірлер: 52
@tutorialsEUC
@tutorialsEUC 2 жыл бұрын
🚀C# Progress Academy - Become a senior C# developer: academy.tutorials.eu/p/csharp-progress-academy Here is the article: tutorials.eu/what-are-lambda-expressions-in-c-sharp/ We'll make sure to turn you into a true developer in no time!
@brrrrr256
@brrrrr256 Жыл бұрын
This does not go anywhere into a discussion of Delegates or Anonymous Methods - which is what Lambda Expressions are built on top of.
@DannysGalaxyTab
@DannysGalaxyTab Жыл бұрын
Well yeah but that would complicate the entire video wouldn't it.
@ErfanDjojan
@ErfanDjojan 9 ай бұрын
@@DannysGalaxyTab Yes and unnecessarily so.
@racmanov
@racmanov Жыл бұрын
That is not lambda tutorial that is Linq tutorial
@MajorSquiggles
@MajorSquiggles Жыл бұрын
This is the worst explanation. It doesn't clarify anything and only leaves more questions. How does it know that p is a person? What is the point of typing out p => p.Age instead of just typing OrderBy(Age)? What do all the other parts of the expression do? They aren't just there for no reason. How does it know which way to sort? Maybe instead of sorting by oldest to youngest I want youngest to oldest. You mostly explained what the end result was but not how it works. I can't use something if I don't know how it works.
@DiegoSynth
@DiegoSynth Жыл бұрын
Yes, yes, yes. Exactly all of this. And when you are NOT a beginner, you write "those crazy for loops" very quickly, because you are doing the reasoning, and you know what you do. I really don't like when programming languages magically do things with no cohesion. And there's obviously explanation to how things happen, but going down into the rabbit hole ends up being much more of a pain than writing the for loop. Microsoft is an expert on magically doing things, hiding the backstage, and clogging the pipeline: You need an html page > you end up with a full environment, with automated authentication, DB bindings, razor pages, MVC models, middleware, etc., etc., etc. Horrible, unscalable, unportable, slow, shit.
@wiljagerhardt1219
@wiljagerhardt1219 Жыл бұрын
p: This is a lambda parameter. It represents an individual element of the people collection during the sorting process. You can think of it as a temporary variable that holds each element of the collection one by one while sorting. =>: This is the lambda operator, which separates the lambda parameter (p) from the lambda body (p.Age). It indicates that the lambda parameter is used to produce the value on the right side of the operator. p.Age: This is the lambda body. It specifies the property Age of the p parameter. In this context, p represents each Person object in the people collection, and p.Age represents the age of each person. When the OrderBy method is executed with the (p => p.Age) lambda expression, it compares the Age property of each Person object and sorts the collection in ascending order based on these ages. In summary, (p => p.Age) is a concise way to provide a sorting key for the OrderBy method. It instructs the method to sort the elements based on the Age property of each Person object in the people collection. In Simple Terms (p => ... ): This is like a short formula that says "for each person in the list, do something." p: It represents one person in the list at a time. It's like a placeholder for each person while the computer is sorting them. p.Age: This says "look at the Age property of the person." Putting it all together, (p => p.Age) means "for each person in the list, look at their Age, and use that value to sort them from youngest to oldest." So, people.OrderBy(p => p.Age) takes the list of people and returns a new sorted list of people, with the youngest person first and the oldest person last, based on their ages. The original list remains unchanged.
@Banalny_Banan
@Banalny_Banan Жыл бұрын
OrderBy can sort something by int. So for it to work, and sort a list of Person objects you need to somehow help it to get those integers from Person objects. It gives you a Person (p is a variable name), then you return p.Age. lambda is a way to define a method with left hand side being input params and right hand side - what you return
@danielbrenjuk7291
@danielbrenjuk7291 Жыл бұрын
P is just a variable name, the name person is the name of the list, and the p => p.Age just tells c# to sort through every element in the list by the value that is contained in the part of the list called Age. OrderBy tells the lambda to sort the list based on provided conditions
@JonWoo
@JonWoo Жыл бұрын
This is just a click bait marketing video for their business. It doesn't teach you anything of value.
@RickSteadX
@RickSteadX Жыл бұрын
It's more of LINQ lesson than lambda expressions..
@Doks_Coders
@Doks_Coders Жыл бұрын
Exactly
@BerkBayar
@BerkBayar 4 ай бұрын
Thank you for clear definition
@thatguyty96
@thatguyty96 Жыл бұрын
Thankyou sir. Also, youre accent is awesome.
@LionKing_Mufasa
@LionKing_Mufasa Жыл бұрын
Thank you very much, you saved me at the last time of my assignment.
@kj.xx23
@kj.xx23 Жыл бұрын
very well said. thank you
@kimutaifelix9092
@kimutaifelix9092 Жыл бұрын
You are a good teacher
@MidnightTsuki
@MidnightTsuki Жыл бұрын
... I feel like I was lied to in my life.
@whitetiana3022
@whitetiana3022 Жыл бұрын
i absolutely despise the lambda operator because it does about 10 different things depending on how you use it.
@cheeseyf1ghter
@cheeseyf1ghter Жыл бұрын
Great Video, thank you so much!! (What font is that?)
@barenyabinayak3255
@barenyabinayak3255 Жыл бұрын
Thank you Very much for this explanation within sort time.👍
@kitsurubami
@kitsurubami 2 жыл бұрын
What about using a Lambda expression without Linq
@tutorialsEUC
@tutorialsEUC 2 жыл бұрын
Yes, you for sure do that: stackoverflow.com/questions/1791510/can-lambdas-be-used-without-linq We can also create a video on that :)
@AndreasToth
@AndreasToth Жыл бұрын
You really shouldn't say that p is a Person but that it is a parameter which you have chosen to call p and which is of the list item type, i.e., Person.
@KillAllCommies2
@KillAllCommies2 5 ай бұрын
I now understand lambda operations even less, thanks!
@JonWoo
@JonWoo Жыл бұрын
How does this speed up your code?
@ВолодимирДрогомирецький-ж1и
@ВолодимирДрогомирецький-ж1и Жыл бұрын
Simple, fast, clear.
@AstralNostalgia
@AstralNostalgia Жыл бұрын
the "input" is "people" and the "expression" is "p"? that is the key for lamda? . I like your video but I am wondering the background behind lamda, cause I am reading the documetnation as well.
@awdsgrgde6979
@awdsgrgde6979 Жыл бұрын
One thing I don't get: how does the program know that person is an element in this list? I may be overcomplicating, but I am horribly stuck on this lambda expression syntax for some reason.
@programmingpersistence5716
@programmingpersistence5716 Жыл бұрын
the OrderBy already knows its expecting a value to be there, give the value any name and it will represent each element in the array or List
@Vykhari1
@Vykhari1 Жыл бұрын
Thank you!!
@zazakage62
@zazakage62 Жыл бұрын
thanks
@caseyspaulding
@caseyspaulding Жыл бұрын
Thank you
@TheHabibpk
@TheHabibpk Жыл бұрын
I really appreciate for very simple explaination
@tutorialsEUC
@tutorialsEUC Жыл бұрын
Glad you like it!
@isuckatthisgame
@isuckatthisgame Ай бұрын
3:07 Lambda expression has nothing to do with iteration.
@burakdemirh
@burakdemirh Жыл бұрын
so is sortedByAge an array?
@charichard09
@charichard09 Жыл бұрын
Late but for future readers, sortedByAge is not an array but a List, created from sorting List people. Hope that helps!
@burakdemirh
@burakdemirh Жыл бұрын
@@charichard09 thanks man
@simonroyjonesuk
@simonroyjonesuk Жыл бұрын
Really helpful. Thanks
@illumi98
@illumi98 Жыл бұрын
Simple and clear. Thank you.
@slowfuse
@slowfuse 10 ай бұрын
video is 4 minutes long. i'm out
@სერგიორმოცაძე
@სერგიორმოცაძე 7 ай бұрын
Basically if someone wants to understand and had to watch this bullshit The left side of the lambda expression is just parameter keep in mind that lambda is basically function but pretty small one so left side of the lambda is parameter and then comes the code what you want to do with that prameter
Send Emails in C# and ASP.NET Core! - It´s actually pretty SIMPLE!
7:30
What are Delegates? (C# Basics, Lambda, Action, Func)
18:39
Code Monkey
Рет қаралды 306 М.
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
C# DELEGATES in 8 minutes! Learn .NET FAST!
8:01
tutorialsEU - C#
Рет қаралды 61 М.
Lambda Expressions in Java - Full Simple Tutorial
13:05
Coding with John
Рет қаралды 792 М.
C# LAMBDA Expressions and ANONYMOUS Functions Tutorial | 2021
14:30
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 2,3 МЛН
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 309 М.
The Right Way to Check for Null in C#
9:35
Nick Chapsas
Рет қаралды 100 М.
you will never ask about pointers again after watching this video
8:03
LINQ + Lambda expressions - C# tutorial
6:14
Tarodev
Рет қаралды 114 М.
C# Yield - Creating Iterators for beginners
5:52
tutorialsEU - C#
Рет қаралды 12 М.
Anonymous Functions Aren't Lambdas
9:08
Dave Leeds
Рет қаралды 4,4 М.