NSoft.NFramework.Tools.TypeTool.IsNumericType C# (CSharp) Method

IsNumericType() public static method

type이 Numeric 수형인지 판단합니다. Generic 클래스나 메소드에서 수학연산을 수행하기 위해 꼭 점검해야 합니다.
public static IsNumericType ( this type ) : bool
type this 대상 수형
return bool
        public static bool IsNumericType(this Type type) {
            type.ShouldNotBeNull("type");

            var isNumeric = false;
            var typeName = type.Name;

            if(type.IsValueType && NumericTypes.Contains(typeName))
                isNumeric = true;

            else if(typeName == "Nullable`1")
                isNumeric = IsNumericType(type.GetGenericArguments()[0]);

            if(IsDebugEnabled)
                log.Debug("수형[{0}] 이 Numeric 수형입니까? 결과=[{1}]", type.Name, isNumeric);

            return isNumeric;
        }