I'm wondering is there any condition instead of T-SQL like in generic lists in C# 4.0.
I've got a gridview on my 开发者_如何学Gopage I got all datas and I need to search by name and lastname, so I think there must be but I couldn't find yet.
Use String.Contains
, String.StartsWith
or String.EndsWith
as part of a predicate, either using List<T>.FindAll
or Where
in LINQ.
For example:
var jons = people
.Where(p => p.FirstName.StartsWith("Jon", StringComparison.CurrentCultureIgnoreCase))
.ToList();
Thats called Contains
精彩评论