LINQ的前pression过滤的FormCollection [英] Linq expression to filter formcollection

查看:158
本文介绍了LINQ的前pression过滤的FormCollection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个的FormCollection,我只是想只能通过按键迭代不包含字符串定价。

I have a FormCollection and I just want to only iterate through the keys the do not contain the string pricing.

那么,我想是这样的...

So what I tried was this...

foreach (var key in collection.AllKeys.Where(k => !k.Contains("Pricing"))){ ... }

问题是回报是不是一个过滤列表中的返回布尔值......在需要字符串过滤列表...

The problem is the return is not a filtered list its returning boolean values... in which in need the filtered list of string...

AllKeys在某种意义上返回一个字符串[],所以我只是想过滤字符串[这里] ...

AllKeys returns a string[] so in a sense I am just trying to filter a string[] here...

我缺少什么这里...

What I am missing here...

谢谢了!

推荐答案

下面就是答案......

Here is the answer...

foreach (var key in collection.AllKeys.Where(k => !k.Contains("Pricing")).ToArray<string>()){ ... }

这篇关于LINQ的前pression过滤的FormCollection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆