示例#1
0
        public static object CreateInstance(this IDotnetExpander expander, string name, object[] args = null)
        {
            string assemblyName, typeName, value;

            expander.ParseName(name, out assemblyName, out typeName, out value);
            if (string.IsNullOrWhiteSpace(value))
            {
                return(expander.CreateInstance(assemblyName, typeName, args));
            }
            var type = expander.GetType(assemblyName, typeName);

            return(ValueExtensions.IsPrimitive(type) ? value.As(type) : expander.CreateInstance(assemblyName, typeName, args));
        }
示例#2
0
 public static T CreateInstance <T>(this IDotnetExpander expander, object[] args = null)
 {
     return((T)expander.CreateInstance(typeof(T), args));
 }
示例#3
0
 public static object CreateInstance(this IDotnetExpander expander, string assemblyName, string typeName, object[] args = null)
 {
     return(expander.CreateInstance(expander.GetType(assemblyName, typeName), args));
 }
示例#4
0
 public static T CreateInstance <T>(this IDotnetExpander expander, string assemblyName, string typeName, object[] args = null)
 {
     return((T)expander.CreateInstance(assemblyName, typeName, args));
 }
示例#5
0
 public static T CreateInstance <T>(this IDotnetExpander expander, string name, object[] args = null)
 {
     return((T)expander.CreateInstance(name, args));
 }