public static TypeParam IsOfType(this TypeParam param, Type type) { if (!param.Type.Equals(type)) { throw ExceptionFactory.CreateForParamValidation(param, ExceptionMessages.EnsureExtensions_IsNotOfType.Inject(param.Type.FullName)); } return(param); }
public static void IsNotOfType(this TypeParam param, Type type) { if (!Ensure.IsActive) { return; } if (param.Type == type) { throw ExceptionFactory.CreateForParamValidation(param, ExceptionMessages.Types_IsNotOfType_Failed.Inject(type.FullName)); } }
public static void IsClass(this TypeParam param) { if (!Ensure.IsActive) { return; } if (!param.Type.GetTypeInfo().IsClass) { throw ExceptionFactory.CreateForParamValidation(param, ExceptionMessages.Types_IsClass_Failed.Inject(param.Type.FullName)); } }
public static TypeParam IsShort(this TypeParam param) { return(IsOfType(param, Types.ShortType)); }
public static TypeParam IsInt(this TypeParam param) { return(IsOfType(param, Types.IntType)); }
public static void IsNotOfType(this TypeParam param, Type expectedType) => Ensure.Type.IsNotOfType(param.Type, expectedType, param.Name, param.OptsFn);
public static TypeParam IsDateTime(this TypeParam param) { return(IsOfType(param, Types.DateTimeType)); }
public static TypeParam IsFloat(this TypeParam param) { return(IsOfType(param, Types.FloatType)); }
public static void IsFloat(this TypeParam param) => IsOfType(param, Types.FloatType);
public static void IsDouble(this TypeParam param) => IsOfType(param, Types.DoubleType);
public static void IsDecimal(this TypeParam param) => IsOfType(param, Types.DecimalType);
public static void IsShort(this TypeParam param) => IsOfType(param, Types.ShortType);
public static void IsInt(this TypeParam param) => IsOfType(param, Types.IntType);
public static void IsInt(this TypeParam param) => Ensure.Type.IsInt(param.Type, param.Name, param.OptsFn);
public static TypeParam IsDecimal(this TypeParam param) { return(IsOfType(param, Types.DecimalType)); }
public static void IsBool(this TypeParam param) => IsOfType(param, Types.BoolType);
public static TypeParam IsDouble(this TypeParam param) { return(IsOfType(param, Types.DoubleType)); }
public static void IsDateTime(this TypeParam param) => IsOfType(param, Types.DateTimeType);
public static TypeParam IsBool(this TypeParam param) { return(IsOfType(param, Types.BoolType)); }
public static void IsString(this TypeParam param) => IsOfType(param, Types.StringType);
public static TypeParam IsString(this TypeParam param) { return(IsOfType(param, Types.StringType)); }
public static void IsDateTime(this TypeParam param) => Ensure.Type.IsDateTime(param.Type, param.Name, param.OptsFn);