开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜