I need to call a method, passing an int. using the following code I can fetch the method but not passing the argument. How to fix it?
dynamic obj; obj = Activator.CreateInstance(Type.GetType(String.Format("{0}.{1}", namespaceName, className))); var method = this.obj.GetType().GetMethod(this.methodName, new Type[] { typeof(int) }); bool isValidated = method.Invoke(this.obj, new object[1]); public void myMethod(int id) { }
method.Invoke(this.obj, new Object[]{ 1 /* id */ });