Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Enum.IsDefined Method

Returns an indication whether a constant with a specified value exists in a specified enumeration.

[Visual Basic]
Public Shared Function IsDefined( _
   ByVal enumType As Type, _
   ByVal value As Object _
) As Boolean
public static bool IsDefined(
 Type enumType,
 object value
public: static bool IsDefined(
 Type* enumType,
 Object* value
public static function IsDefined(
   enumType : Type,
 value : Object
) : Boolean;


An enumeration type.
The value or name of a constant in enumType.

Return Value

true if a constant in enumType has a value equal to value; otherwise, false.


Exception Type Condition
ArgumentNullException enumType or value is a null reference (Nothing in Visual Basic).
ArgumentException enumType is not an Enum.


The type of value is not an enumType.


The type of value is not an underlying type of enumType.

InvalidOperationException value is not type SByte, Int16, Int32, Int64, Byte, UInt16, UInt32, or UInt64, or String.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Enum Class | Enum Members | System Namespace

© 2017 Microsoft