示例#1
0
        public static object GetDefaultValue(this SupportedTypes value)
        {
            var type = Type.GetType(value.GetAssemblyDescription(Constants.TypeDescription));

            if (type.IsValueType)
            {
                return(Activator.CreateInstance(type));
            }
            return(null);
        }
        public static bool IsValidValue(SupportedTypes type, object value)
        {
            var currentType = Type.GetType(type.GetAssemblyDescription(Constants.TypeDescription));

            try
            {
                Convert.ChangeType(value, currentType);
                return(true);
            }
            catch
            {
                return(false);
            }
        }