示例#1
0
        public static bool IsSimpleType(this Type type)
        {
            if (SimpleTypes.Contains(type) || type.IsEnum)
            {
                return(true);
            }
            var nullableWrapped = Nullable.GetUnderlyingType(type);

            return(nullableWrapped != null && nullableWrapped.IsSimpleType());
        }
示例#2
0
		private dynamic ParseValue(Type propertyType, string value, string key, MethodInfo methodInfo, ref string sParseError)
		{
			dynamic result;

			if (propertyType == typeof(string))
			{
				result = value;
			}
			else if (propertyType == typeof(bool))
			{
				result = Parser.ParseBoolean(key, value, ref sParseError);
			}
			else if (propertyType == typeof(short))
			{
				result = Parser.ParseInt16(key, value, ref sParseError);
			}
			else if (propertyType == typeof(int))
			{
				result = Parser.ParseInt32(key, value, ref sParseError);
			}
			else if (propertyType == typeof(long))
			{
				result = Parser.ParseInt64(key, value, ref sParseError);
			}
			else if (propertyType == typeof(DateTime))
			{
				result = Parser.ParseDateTime(key, value, ref sParseError);
			}
			else if (SimpleTypes.Contains(propertyType))
			{
				result = Parser.ParseValue(propertyType, key, value, ref sParseError);
			}
			else    // enum, class or struct
			{
				var parameters = new object[] { key, value, sParseError };
				result = methodInfo.Invoke(Parser, parameters);
				sParseError = (string)parameters[2];
			}
			return result;
		}
示例#3
0
 public static bool IsSimple(this Je.ISysExpander e, Type type)
 {
     return(type != null && (type.IsEnum || SimpleTypes.Contains(type)));
 }