Is Type Signed - CSharp System

CSharp examples for System:Type

Description

Is Type Signed

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Linq.Expressions;
using System.Linq;
using System.Collections.Generic;
using System;//  w ww . jav  a  2 s  .c om
using SafeILGenerator.Ast.Nodes;

public class Main{
    static public bool IsTypeSigned(Type Type)
      {
         if (!Type.IsPrimitive) return false;
         return (
            Type == typeof(sbyte) ||
            Type == typeof(short) ||
            Type == typeof(int) ||
            Type == typeof(long) ||
            Type == typeof(float) ||
            Type == typeof(double) ||
            Type == typeof(decimal)
         );
      }
}

Related Tutorials