Check if Key Exists in NameValueCollection

后端 未结 12 710
执念已碎
执念已碎 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条回答
  •  春和景丽
    2020-12-13 17:09

    In VB it's:

    if not MyNameValueCollection(Key) is Nothing then
    .......
    end if
    

    In C# should just be:

    if (MyNameValueCollection(Key) != null) { }
    

    Not sure if it should be null or "" but this should help.

提交回复
热议问题