Mega Code Archive

 
Categories / VB.Net / Reflection
 

Type IsValueType Property tells whether the Type is a value type

Imports System Imports Microsoft.VisualBasic Namespace SystemType     Public Class [MyClass]         Enum MyEnum             One             Two         End Enum          Public Overloads Shared Sub Main()             Try                 Dim myBool As Boolean = False                 Dim myTestEnum As MyEnum = MyEnum.One                 Dim myType As Type = myTestEnum.GetType()                 myBool = myType.IsValueType                 Console.WriteLine(ControlChars.Cr + "Is {0} a value type? {1}.", myType.FullName, myBool.ToString())             Catch e As Exception                 Console.WriteLine(ControlChars.Cr + "An exception occurred: {0}", e.Message.ToString())             End Try         End Sub 'Main     End Class '[MyClass] End Namespace 'SystemType