AW: AW: [Mono-list] Checking key existance in a NameValueCollection

Shawn Vose mono@programmerforrent.com
Wed, 13 Oct 2004 10:47:17 -0400


I think it should be in a try statement because if the key doesnt exist 
it will throw an  exception.
Additionally in c# it would use [] instead of ()

try{
    if !(Request.Form["key"]  == null){
      // do something
    }else{
       //do something to handle a null value
    }
}catch(Exception e){
    //the key doesnt exists
}

Jochen Wezel (CompuMaster GmbH) wrote:

>Something like 
>If (Request.Form("key") == null)
>{
>	//blah
>}
>
>-----Ursprüngliche Nachricht-----
>Von: Fabien Meghazi [mailto:amigrave@gmail.com] 
>Gesendet: Mittwoch, 13. Oktober 2004 14:14
>An: Jochen Wezel (CompuMaster GmbH)
>Betreff: Re: AW: [Mono-list] Checking key existance in a NameValueCollection
>
>  
>
>>In VB.NET, I'd say:
>>If Not Request.Form("key") Is Nothing Then
>>        'some dos...
>>End If
>>    
>>
>
>Do you know the equivalent in C# ?
>
>
>_______________________________________________
>Mono-list maillist  -  Mono-list@lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>  
>