Type.IsPrimitive Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets a value indicating whether the Type is one of the primitive types.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

abstract IsPrimitive : bool with get
override IsPrimitive : bool with get

Property Value

Type: System.Boolean

true if the Type is one of the primitive types; otherwise, false.

The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Char, Double, and Single.

If the current Type represents a generic type, or a type parameter in the definition of a generic type or generic method, this property always returns false.

The 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.

No code example is currently available or this language may not be supported.

.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
Return to top
Show: