Is Propagatable Type - CSharp System.Reflection

CSharp examples for System.Reflection:Type

Description

Is Propagatable Type

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Runtime.Serialization;
using System.Runtime.CompilerServices;
using System.Reflection.Emit;
using System.Reflection;
using System.Linq;
using System.IO;/*from  w w  w.ja  v  a 2 s  .c om*/
using System.Globalization;
using System.Collections.Generic;
using System;

public class Main{
        public static bool IsPropagatableType(this Type t)
        {
            return
                t == typeof(string) ||
                t == typeof(char) ||
                t == typeof(float) ||
                t == typeof(double) ||
                t == typeof(byte) ||
                t == typeof(sbyte) ||
                t == typeof(short) ||
                t == typeof(ushort) ||
                t == typeof(int) ||
                t == typeof(uint) ||
                t == typeof(long) ||
                t == typeof(ulong) ||
                t == typeof(bool) ||
                t.IsEnum();
        }
        public static bool IsEnum(this Type type)
        {
            var info = type.GetTypeInfo();

            return info.IsEnum;
        }
}

Related Tutorials