How do I specify the type of the range variable in a LINQ query?
How do I开发者_如何学JAVA specify the type of the range variable in a linq query?
Just declare it with the variable itself:
var query = from string text in collection
where text.Length > 5
select text.ToUpper();
This will translate to:
var query = collection.Cast<string>()
.Where(text => text.Length > 5)
.Select(text => text.ToUpper());
精彩评论