[Mono-list] BaseCompareValidator

Derek Holden dsh2120@draper.com
Mon, 29 Oct 2001 15:45:06 -0500


Check out the System.Type class, specifically the IsInstanceOf methods.

Type validationDataType = typeof(ValidationDataTypeValue);
if (!validationDataType.IsInstanceOfType(param)) blah;

----- Original Message -----
From: "Gaurav Vaish" <gvaish@iitk.ac.in>
To: <mono-list@ximian.com>
Sent: Monday, October 29, 2001 3:23 PM
Subject: [Mono-list] BaseCompareValidator


> Hello,
>     For the field System.Web.UI.WebControls.BaseCompareValidator.Test, the
> signature is:
>
> 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
>
>     Quite cumbersome. Any shorter methods would be highly appreciated.
>
>
> Cheers,
> Gaurav Vaish
> ----------------------------
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list