C# TypeInfo IsPrimitive

Description

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

Syntax

TypeInfo.IsPrimitive has the following syntax.


public bool IsPrimitive { get; }

Example


using System;/*from w w w .j  av a2  s.c  o  m*/
using System.Runtime.Remoting.Contexts;
public class MyContextBoundClass: ContextBoundObject
{
    public string myString = "IsPrimitive properties.";
}
public class MyTypeDemoClass
{
    public static void Main()
    {
       Console.WriteLine ("Is {0} is a primitive data type? {1}.", typeof(int).Name, typeof(int).IsPrimitive);
       Console.WriteLine ("Is {0} a primitive data type? {1}.", typeof(string).Name, typeof(string).IsPrimitive);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo