Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 391
  • Last Modified:

movies = movies.Where(s => s.Title.Contains(searchString));

Can someone explain me what the S stand for in
    movies = movies.Where(s => s.Title.Contains(searchString));

Thank you,
0
yguyon28
Asked:
yguyon28
1 Solution
 
käµfm³d 👽Commented:
It's a variable that holds the current movie in the collection while the Where is iterating. You can roughly translate the Where into this:

List<Movie> filteredMovies = new List<Movie>();

foreach (Movie s in movies)
{
    if (s.Title.Contains(searchString))
    {
        filteredMovies.Add(s);
    }
}

movies = filteredMovies;

Open in new window

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now