/// <summary> /// Create instance of class specified by string classname(a,b,c) /// </summary> /// <param name='ctorInvocation'> /// constructor spec (ie FooClass(1.3,4.45,test) /// </param> public static object NewByCtor(string ctorInvocation) { CtorParser parser = new CtorParser(ctorInvocation); object[] args = parser.Arguments; Type type = ReflectUtils.FindType(parser.Class); return(NewInstance(type, args)); }
/// <summary> /// Create instance of class specified by string classname(a,b,c) /// </summary> /// <param name='ctorInvocation'> /// constructor spec (ie FooClass(1.3,4.45,test) /// </param> public static object NewByCtor(string namespc, string ctorInvocation) { CtorParser parser = new CtorParser(ctorInvocation); object[] args = parser.Arguments; Type type = null; if (parser.Class.IndexOf('.') > 0) { type = ReflectUtils.FindType(parser.Class); } else { type = ReflectUtils.FindType(namespc + "." + parser.Class); } return(NewInstance(type, args)); }