开发者

How do I specify the type of the range variable in a LINQ query?

开发者 https://www.devze.com 2022-12-18 02:34 出处:网络
How do I开发者_如何学JAVA specify the type of the range variable in a linq query?Just declare it with the variable itself:

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());
0

精彩评论

暂无评论...
验证码 换一张
取 消