As discussed in the comments, either use
Substring(0, 5)
:
db.Site.Where(t => t.Nom.Substring(0, 5) == countryCode)
or
StartsWith
:
db.Site.Where(t => t.Nom.StartsWith(countryCode))
Substring
will throw an exception if the name is not at least five characters long.
StartsWith
can return
true
even if the
countryCode
is not exactly five characters long.