The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
Type::IsPrimitiveImpl Method ()
.NET Framework (current version)
When overridden in a derived class, implements the IsPrimitive property and determines whether the Type is one of the primitive types.
Assembly: mscorlib (in mscorlib.dll)
The following example determines whether the given type is a primitive type and displays the result.
using namespace System; using namespace System::Reflection; public ref class MyTypeDelegatorClass: public TypeDelegator { public: String^ myElementType; private: Type^ myType; public: MyTypeDelegatorClass( Type^ myType ) : TypeDelegator( myType ) { this->myType = myType; } protected: // Override the IsPrimitiveImpl. virtual bool IsPrimitiveImpl() override { // Determine whether the type is a primitive type. if ( myType->IsPrimitive ) { myElementType = "primitive"; return true; } return false; } }; int main() { try { Console::WriteLine( "Determine whether int is a primitive type." ); MyTypeDelegatorClass^ myType; myType = gcnew MyTypeDelegatorClass( int::typeid ); // Determine whether int is a primitive type. if ( myType->IsPrimitive ) { Console::WriteLine( "{0} is a primitive type.", int::typeid ); } else { Console::WriteLine( "{0} is not a primitive type.", int::typeid ); } Console::WriteLine( "\nDetermine whether String is a primitive type." ); myType = gcnew MyTypeDelegatorClass( String::typeid ); // Determine if String is a primitive type. if ( myType->IsPrimitive ) { Console::WriteLine( "{0} is a primitive type.", String::typeid ); } else { Console::WriteLine( "{0} is not a primitive type.", String::typeid ); } } catch ( Exception^ e ) { Console::WriteLine( "Exception: {0}", e->Message ); } }
.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: