Mega Code Archive

 
Categories / VB.Net / Reflection
 

Type IsSerializable Property tells indicating whether the Type is serializable

Imports System Imports Microsoft.VisualBasic     Public Class [MyClass]         <Serializable()> Public Class MyTestClass         End Class          Public Overloads Shared Sub Main()             Try                 Dim myBool As Boolean = False                 Dim myTestClassInstance As New MyTestClass()                 Dim myType As Type = myTestClassInstance.GetType()                 myBool = myType.IsSerializable                 Console.WriteLine(myBool.ToString())             Catch e As Exception                 Console.WriteLine(e.Message.ToString())             End Try         End Sub     End Class