Linq expression to filter formcollection

前端 未结 2 426
情书的邮戳
情书的邮戳 2021-01-02 18:53

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 (         


        
2条回答
  •  猫巷女王i
    2021-01-02 19:19

    Here is the answer...

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

提交回复
热议问题