Type.IsPrimitive Property
.NET Framework (current version)
Gets a value indicating whether the Type is one of the primitive types.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Booleantrue if the Type is one of the primitive types; otherwise, false.
Implements
_Type.IsPrimitiveThe following example demonstrates the IsContextful, IsMarshalByRef, and IsPrimitive properties of the Type class. It checks whether the given type can be hosted in the context, whether it can be marshaled by reference, and whether the type is a primitive data type.
Imports System.Runtime.Remoting.Contexts Public Class ContextBoundClass : Inherits ContextBoundObject Public Value As String = "The Value property." End Class Public Class Example Public Shared Sub Main() ' Determine whether the types can be hosted in a Context. Console.WriteLine("The IsContextful property for the {0} type is {1}.", GetType(Example).Name, GetType(Example).IsContextful) Console.WriteLine("The IsContextful property for the {0} type is {1}.", GetType(ContextBoundClass).Name, GetType(ContextBoundClass).IsContextful) ' Determine whether the types are marshalled by reference. Console.WriteLine("The IsMarshalByRef property of {0} is {1}.", GetType(Example).Name, GetType(Example).IsMarshalByRef) Console.WriteLine("The IsMarshalByRef property of {0} is {1}.", GetType(ContextBoundClass).Name, GetType(ContextBoundClass).IsMarshalByRef) ' Determine whether the types are primitive datatypes. Console.WriteLine("{0} is a primitive data type: {1}.", GetType(Integer).Name, GetType(Integer).IsPrimitive) Console.WriteLine("{0} is a primitive data type: {1}.", GetType(String).Name, GetType(String).IsPrimitive) End Sub End Class ' The example displays the following output: ' The IsContextful property for the Example type is False. ' The IsContextful property for the ContextBoundClass type is True. ' The IsMarshalByRef property of Example is False. ' The IsMarshalByRef property of ContextBoundClass is True. ' Int32 is a primitive data type: True. ' String is a primitive data type: False.
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Show: