using System;
using System.Collections.Generic;
using System.Text;
namespace EdjCase.JsonRpc.Core.Utilities
{
public static class TypeExtensions
{
///
/// Determines if the type is a number
///
/// Type of the object
/// Includes a check for whole number types. Defaults to true
/// True if the type is a number, otherwise False
public static bool IsNumericType(this Type type, bool includeInteger = true)
{
if (includeInteger)
{
return type == typeof(long)
|| type == typeof(int)
|| type == typeof(short)
|| type == typeof(float)
|| type == typeof(double)
|| type == typeof(decimal);
}
else
{
return type == typeof(float)
|| type == typeof(double)
|| type == typeof(decimal);
}
}
}
}