Ok, so essentially, this method(), tho I think technically may be an extension… it is running thru all in the list answerUnits.
But, I have a couple of questions,
au, this is what? Obviously it needs to equate to an answerUnits*. But where I am confused is,* since this is not runnig thru a for(), how is the method gathering each answerUnits?
PS. I have not tested, as I was leaving.
Will test.
Thanks!
Basically LINQ methods, like OrderByDescending, operate on lists (any IEnumerable actually) and return searched/reordered/transformed versions. Lambda expressions are of the form “x => DoSomething(x)” and translate to “given a variable x, do this to it”. It’s like a mini function where the parameter names are on the left side and the function body is on the right side. There’s more to it than that but those are the basics.
Yes, the variable name on the left side of the lambda “=>” is sort of auto-declared, and it figures out what type it is by the statement that it’s in; in your case the type is “GameObject”, which it knows because you are calling OrderByDescending on a list of GameObjects.
To make it more clear, when you call someList.OrderByDescending(thing => thing.someNumber), it is saying “go through someList, and for each element, which we’ll call “thing”, get thing.someNumber, and use that value to decide what order to put the list in”.
First, it mentioned that I can not convert a float to a someClass. So I changed the class of the secondary list, from float, to someClass, but still an error.