0

What is the ! operator right after Title?

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

Zagros
  • 142
  • 2
  • 10
  • 2
    It's the [null-forgiving operator](https://learn.microsoft.com/dotnet/csharp/language-reference/operators/null-forgiving), telling the compiler we are sure that `s.Title` is not `null` even if it might think it is. There is no effect on the LINQ query itself. – Jeroen Mostert May 18 '22 at 20:42
  • Oh well, I know that is the case when passing over arguments to a method, but I never saw this working with a LINQ query before. Thanks! – Zagros May 18 '22 at 20:44

0 Answers0