Check if Key Exists in NameValueCollection

后端 未结 12 720
执念已碎
执念已碎 2020-12-13 16:42

Is there a quick and simple way to check if a key exists in a NameValueCollection without looping through it?

Looking for something like Dictionary.ContainsKey() or

12条回答
  •  Happy的楠姐
    2020-12-13 17:10

    NameValueCollection n = Request.QueryString;
    
    if (n.HasKeys())
       {
           //something
       }
    

    Return Value Type: System.Boolean true if the NameValueCollection contains keys that are not null; otherwise, false. LINK

提交回复
热议问题