[Mono-list] BaseCompareValidator

Gaurav Vaish gvaish@iitk.ac.in
Tue, 30 Oct 2001 09:18:40 +0530


Thanks.
    I think then I should directly use:

..
    set
    {
        if(System.Enum.IsDefined(typeof(ValidationDataType), value))
            // assign the value here itself

        /*    Since if the value is not defined, the function call itself
will throw the exception  */
    }
..


Cheers,
Gaurav Vaish
----------------------------

----- Original Message -----
From: "Miguel de Icaza" <miguel@ximian.com>
To: "Gaurav Vaish" <gvaish@iitk.ac.in>
Sent: Tuesday, October 30, 2001 02:04
Subject: Re: [Mono-list] BaseCompareValidator


> On Mon, 2001-10-29 at 15:23, Gaurav Vaish wrote:
> > public ValidationDataType Type {get; set;}
> >
> >     while is throws an ArgumentException if the specified data is not of
the
> > ValidationDataTypeValue. How do I check that? Should it be something
like
> >     1. Make a local instance of ValidationDataType
> >     2. Get an enumerator / array of all the members using reflection
> > mechanism
> >     3. Compare the value with these
> >     4. If no match is found, throw the exception
>
> You can use:
>
> public ValidationDataType Type {
>   get {
>      ..
>   }
>
>   set
> if (!System.Enum.IsDefined (typeof (ValidationDataType), value))
>              throw ...
> }