I am reading through a book and it gives an example of the Sort Method along with a Lambda query.
An example is {Product.Sort( (x,y) => x.Name.CompareTo(y.Name) );
This really took me a while to understand as I did not understand how .Sort
was dealing with the two inputs on the lambda.
I tried clicking on Sort
and pressing F1
for help, but, it didn't give anything, that made any sense to me.
Perhaps I am just not good enough to understand those examples, but, I just could not work out how this was working until I changed the Lambda to x,y,z
which gave the error Error Delegate 'System.Comparison<ConsoleApplication1.Product>' does not take 3 arguments
Which made a lot more sense to me... Anyway, after a while of looking around, I am confident that I understand the Sort method, but, it took me a lot longer than I am happy with.
From people who are much better than me - given a situation like this, how would you search for help?
By typing Shift+SpaceI was also able to produce the following:
However, I am just wondering, as a C# learner, how can I attribute this to requiring a Lambda with two inputs?