I am going through this ASP MVC tutorial . This tutorial page is about writing a simple search page. The controller contains this method:
public ActionResult SearchIndex(string searchString)
{
var movies = from m in db.Movies
select m;
if (!String.IsNullOrEmpty(searchString))
{
movies = movies.Where(s => s.Title.Contains(searchString));
}
return View(movies);
}
According to MSDN, it String.Containsis case sensitive. But when I go to [website url]/Movies/SearchIndex?searchString=mel, it returns a movie with a title in the end Melancholia. If I test the controller method in the debugger, it searchStringwill be mel(in lowercase) as expected.
Why is String.Containsthis type case-insensitively consistent?
source
share