From the course: C# Cross-Platform Development

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Executing search and displaying results

Executing search and displaying results

From the course: C# Cross-Platform Development

Executing search and displaying results

- [Instructor] In this video, we're going to execute the LINQ query that we prepared in the previous video and present the results to the user. If no matching notes are found, we'll also display a message to tell the user that we couldn't find the note based on the keyword they supplied. In the previous video, we used a breakpoint to test that the query was working. Let's go ahead and remove that breakpoint, if you still have it, and finish our command with the rest of the code we need to display the notes that have been found. We'll start by creating a new variable called notes, and we're going to set it equal to notesQuery.ToList. ToList is a LINQ method that forces immediate query execution and returns a list that contains the query results. This method is often used when it's important to cache the results of a query. Now we need to make sure that we actually have some notes to display. So let's create a new…

Contents