[Mono-list] Checking key existance in a NameValueCollection

Arnaud Bienvenu arnaud.bienvenu@makina-corpus.org
Wed, 13 Oct 2004 14:10:37 +0200


Fabien Meghazi a écrit :
> I'm trying to check if a key exists in the NameValueCollection
> HttpContext.Current.Request.Form and I don't know how to do this.

I would do :
if (Request.Form["mykey"] != null)

This makes no difference between a non-existent key, and a key that 
exists but contains a null value. However, I guess the latter will never 
happen in Request.Form.

-- 
Arnaud Bienvenu
Makina Corpus