We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

StenliH • 4 years ago

Really helpful, thanks a lot! It learns how to linq-think and it's perfect for beginners to get themselves oriented in the subject. Excelent work!

John (Kelly) Worrall • 3 years ago

This seems a bit of a silly test case...

About to test GetLastWordWithHerInIt({where, where, where, where})
IN: <{where, where, where, where}> OUT: <where>

(Edit: Loving the tutorial and thank you! The test above, looking to make sure the output was "where", doesn't mean the code was written correctly, I would think)

Kodnot • 6 years ago

Great playground. I would really like to see the proper / your solution to the second combined exercise, because I think I cheated a bit in my solution, and I cannot think of a better way to solve it. Maybe it would be a good idea in general to show solutions to the exercises after they are solved, as there are often multiple ways to solve a task, and seeing an alternative solution might be beneficial.

player_one • 6 years ago

I should probably update this course with the new "spoiler" construct that tech.io recently added. In the meantime, though, you can see all my solutions in the github. All exercises are unit tested, and have a solution in the repository. This particular one is at:

https://github.com/danBhent...

ursusfelis • 6 years ago

where is "Run My Code" button in Lambda expressions examples before Exercise section?

Riham_Muneer • 9 months ago

Thanks!! The most helpful way to learn LINQ I've ever seen

Creeps-kun • 4 years ago

Shapeshifter • 4 years ago

For the very last question I got the same answer as in the github solution, but something is bothering me about all this...
Without revealing too much, one of the tests pumps in 5 words, of which 3 pass the filter test, and these 3 are ordered. Then the transform part that returns an english sentence is (seemingly) applied to all 3 of these before always returning the last one. Isn't this incredibly inefficient? If you were writing this as a traditional structured program, you would take the last item from the ordered list BEFORE adding it to the sentence, so it is only ever done once (at most). What am I missing?

Shapeshifter • 3 years ago

I posted this a year ago. Any response to this please? It STILL makes no sense. If the list had 1 million words and half had an 'e'. you would be making half a million strings just to return one of them!

Shapeshifter • 3 years ago

Probably should have made clear this is all for 'combined exercise 2'. Anyhoo...

Just come up with a more satisfactory solution that inserts 'TakeLast(1)' between orderby and select(). Works great in VSCode and only performs select on one word as I wanted! But here I get an error to the effect of 'TakeLast is not a method/extension of IOrderedEnumerable'.

Anonymous • 4 years ago

// Return all distinct words that have less than four letters in them.
public static IEnumerable<string> GetDistinctShortWords(
IEnumerable<string> words)
{
// Uncomment:
return words.Where(theStr => theStr.Length<4).Distinct();
}

Anonymous • 4 years ago

return words.SkipWhile(theStr=> theStr!="start").TakeWhile(theStr=>theStr!="end");

Gloops • 4 years ago

Hello, well, to return all elements of a collection in a line ... I did it easily with String.Join, but ...

Any idea how to do it with Linq ?
Or any idea to apply a treatment to only the last element ?

tom103 • 6 years ago

Layout issue in Firefox: http://i.imgur.com/hxEmCqV.png

[CG]Nick • 6 years ago

Thanks for the report, it should be fixed in a few minutes

Joe • 4 years ago

Can anyone help me with this? I have this app on my phone where I'm trying to learn/practice on some C#. Anyways, I've been stuck on these 6 lines of code that I have to put into order and I can't seem to figure out the order. Here they are:

class Dog : Animal {
string name;
}
Dog (string name) {
this.name = name;
}

The code is correct, it's just the order of the 6 lines that must be organized. I think that I already have them in the correct order, however, the app insists that I'm not correct. Can anyone see a different order that I'm not seeing? Thank you all for your help. By the way, this is NOT for any grade. Like I said, its just an app on my phone called Mimo.

class Dog : Animal {
string name;

Dog (string name) {
this.name = name;
}

}

Andy • 4 years ago

try moving the "}" on line 3 to the end

ursusfelis • 6 years ago

All the time i think lambda expressions must be declared and used inside a method. I think that because it shortness