Snooping around in the Enum class gave me the solution:
MessageBox.Show(System.Enum.IsDefined(typeof(myEnum), paraEnum).ToString());
Einar
>I know I have read this somewhere but I can't seem to find that article at the moment.
>Considder the following example:
>
>private void button1_Click(object sender, System.EventArgs e)
>{
> myMethod(myEnum.two);
> myMethod((myEnum)0xDD);
>}
>private void myMethod(myEnum paraEnum)
>{
> MessageBox.Show(paraEnum.ToString());
>}
>public enum myEnum: byte
>{
> one = 0x01,
> two = 0x02,
> ff = 0xff
>}
>
>
>I want to pass an enum as a parameter to a method, but the first thing I want to check for in the method is if it is a valid enum(i.e. an enum member).
>
>Any thoughts?
>
>Einar
Semper ubi sub ubi.