Mega Code Archive

 
Categories / VB.Net / Data Types
 

Enum IsDefined Method tells whether a constant with a specified value exists in a specified enumeration

<Flags> Public Enum PetType As Integer    None = 0    Dog = 1    Cat = 2    Rodent = 4    Bird = 8    Reptile = 16    Other = 32 End Enum Module Example    Public Sub Main()       Dim value As Object       value = 1       Console.WriteLine("{0}: {1}", value, [Enum].IsDefined(GetType(PetType), value))    End Sub End Module