+
+
+```csharp
var methodResult = persons
+ .Where(person =>
+ person.Country == "Finland");
+```
-.Where(person => person.Country == "Finland");
+
+
+```csharp
var queryResult = from person in persons
+ where person.Country == "Finland"
+ select person;
+```
-where person.Country == "Finland"
+
+
-select person;
+* All queries listed here: [https://www.tutorialsteacher.com/linq/linq-standard-query-operators](https://www.tutorialsteacher.com/linq/linq-standard-query-operators)
-All queries listed here: [https://www.tutorialsteacher.com/linq/linq-standard-query-operators](https://www.tutorialsteacher.com/linq/linq-standard-query-operators)
+## `ToArray()` and `ToList()` methods
-# ToArray() and ToList() Methods
+* Notice that the LINQ queries return an `IEnumerable`
+* If you need to use arrays or lists, you need to call the `ToArray()` or `ToList()` methods
-Notice that the LINQ queries return an IEnumerable
-
-If you need to use arrays or lists, you need to call the ToArray() or ToList() methods:
-
-string[] strings = new string[] { "Timo", "Pekka", "Taina", "Kalle" };
-
-string[] queryResult = strings
-
-.Where(s => s.StartsWith('T'));
+
+
+ ```csharp
+ string[] strings = new string[]
+ { "Timo", "Pekka", "Taina", "Kalle" };
+ string[] queryResult = strings
+ .Where(s => s.StartsWith('T'));
+ ```

-string[] strings = new string[] { "Timo", "Pekka", "Taina", "Kalle" };
+
+
+```csharp
+string[] strings = new string[]
+ { "Timo", "Pekka", "Taina", "Kalle" };
string[] queryResult = strings
+ .Where(s => s.StartsWith('T'))
+ .ToArray();
+```
-.Where(s => s.StartsWith('T'))
-
-.ToArray(); // This works
-
-# Exercise 2: Filtering Names
-
-Download this file of names and add it to your project folder: [https://raw.githubusercontent.com/dominictarr/random-name/master/names.txt](https://raw.githubusercontent.com/dominictarr/random-name/master/names.txt)
-
-Read all the contents into a string array with File.ReadAllLines()
-
-Create a main loop where the user is asked for a string. Print the total number of names which contain that string.
-
-If there are less than 10 resulting names, print the names as well
-
-# Exercise 3: Queries on Object Lists
-
-Expand on the exercise 2.
+No error!
-Create a new class User with two properties, int Id and string Name
+
+
-If the number of filtered names is less than 10, create a list of Users with those names and a running Id
-Sort the list of users by the length of the Name property
-Print the names and id:s of the users in the sorted list
-# Going Further: Extension Methods
+## Exercise 2: Filtering Names
+
-Recap: IEnumerable itself only contains one method
+* Download this file of names and add it to your project folder: [https://raw.githubusercontent.com/dominictarr/random-name/master/names.txt](https://raw.githubusercontent.com/dominictarr/random-name/master/names.txt)
+* Read all the contents into a string array with `File.ReadAllLines()`
+* Create a main loop where the user is asked for a string. Print the total number of names which contain that string.
+* If there are less than 10 resulting names, print the names as well!
-How does the LINQ library suddenly add all these methods to our Enumerables?
+## Exercise 3: Queries on Object Lists
+
-This is possible with extension methods:
+* Expand on the exercise 2.
+* Create a new class User with two properties, int Id and string Name
+* If the number of filtered names is less than 10, create a list of Users with those names and a running Id
+* Sort the list of users by the length of the Name property
+* Print the names and id:s of the users in the sorted list
-[https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods)
+## Going Further: Extension Methods
+* Recap: `IEnumerable` itself only contains one method
+* How does the LINQ library suddenly add all these methods to our Enumerables?
+* This is possible with [extension methods](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods)!
\ No newline at end of file