Honestly the fastest way to learn these lambda expressions is just to do katas the way you know how to do and then compare your solution. When I learned C# that's just what I did. :)
Do not think "I would have never come up with this simple solution", but rather "Oh so that's also a way to do it".
Ahh i came up with a very very simple way to cheat... oh well..
However looking at the other answers makes me realise that there is something other then a property that one can make public in an object..
According to my googlefoo (https://www.lucidchart.com/pages/flowcharts/star-trek) we have to cheat to win. However the warbird class is a completely empty object type. No Properties or Methods one could inject code into. I must be missing something :(
if ( bmi <= 18.5 ) will return a value thus none of the following statements will be checked.
oh ye you are right my bad.
impossible
This won't actuall work properly. If you have 10 for example, all 3 options will be triggered
In my opinion this is the best solution.
Be aware that this solution will cause the entire contents of the results list to be held in memory, negating the benefits of IEnumerable.
This could lead to out-of-memory exceptions when when dealing with lots of elements, and especially when dealing with large objects.
It is a non-issue if the incoming enumerables are expected to be of reasonable size.
Elegant !
Honestly the fastest way to learn these lambda expressions is just to do katas the way you know how to do and then compare your solution. When I learned C# that's just what I did. :)
Do not think "I would have never come up with this simple solution", but rather "Oh so that's also a way to do it".
Keep on keeping on!
Thanks for reply, I will do it.
Please mark your post as having spoiler content next time. It's visible in the homepage otherwise.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Ahh i came up with a very very simple way to cheat... oh well..
However looking at the other answers makes me realise that there is something other then a property that one can make public in an object..
According to my googlefoo (https://www.lucidchart.com/pages/flowcharts/star-trek) we have to cheat to win. However the
warbird
class is a completely empty object type. No Properties or Methods one could inject code into. I must be missing something :(This comment is hidden because it contains spoiler information about the solution
Loading more items...