private static bool TryGetSupportedType(Type t, out SupportedCustomType supported) { if (t == typeof(int) || t == typeof(short) || t == typeof(long)) { supported = SupportedCustomType.Int; return(true); } if (t == typeof(bool)) { supported = SupportedCustomType.Bool; return(true); } if (t == typeof(DateTime)) { supported = SupportedCustomType.DateTime; return(true); } if (t == typeof(Guid)) { supported = SupportedCustomType.Guid; return(true); } if (t == typeof(float) || t == typeof(double)) { supported = SupportedCustomType.Double; return(true); } if (t == typeof(string)) { supported = SupportedCustomType.String; return(true); } supported = 0; return(false); }
/// <exception cref="ArgumentOutOfRangeException">Condition.</exception> public static CustomType GetCustomType(SupportedCustomType t) { switch (t) { case SupportedCustomType.Int: return(Int); case SupportedCustomType.Double: return(Double); case SupportedCustomType.DateTime: return(DateTime); case SupportedCustomType.Guid: return(Guid); case SupportedCustomType.String: return(String); case SupportedCustomType.Bool: return(Bool); default: throw new ArgumentOutOfRangeException($"{t} : {t.GetType()} is not a supported custom type."); } }
private static string Name(SupportedCustomType t) { return(t + "Properties"); }