[Mono-winforms-list] Splitter

Aleksandar Dezelin dezelin32@fastmail.fm
Sat, 18 Dec 2004 14:29:32 +0100


Jordi Mas wrote:

> 
> Some comments:
> 
> 1) Instead of checking for all the valid values of an enum:
> 
> if (value != DockStyle.Top && value != DockStyle.Bottom &&     value !=
> DockStyle.Left && value != DockStyle.Right)        {
> throw new ArgumentException("Invalid Splitter dock style.");
> 
> You can use Enum.IsDefined. For example:
> 
> if (!Enum.IsDefined (typeof (Orientation), value))
> throw new InvalidEnumArgumentException (string.Format("Enum argument
> value '{0}' is not valid for Orientation", value));
> 

Thanks!


Cheers,
Aleksandar Dezelin



-- 
Linux is like wigwham - no windows, no gates, and apache inside...