buunguyen / fasterflect

.NET Reflection Made Fast and Simple ⛺
https://www.nuget.org/packages/fasterflect/
Apache License 2.0
285 stars 57 forks source link

Example for multiple parameters in method call #7

Closed AlexanderRodecape closed 5 years ago

AlexanderRodecape commented 5 years ago

Sorry, can you add an example of how to call a method with multiple parameters?

How should the objectOfParameters be created? objectCalledUpon.CallMethod(methodInfo.Name, objectOfParameters);

AlexanderRodecape commented 5 years ago

Looks like I just needed to add the parameters to a list List list = new List(); // loop through parameters/get your params Type type = methodProperty.ParameterType; var prop= Convert.ChangeType(your-value, type); list.Add(prop);
// end loop var array = list.ToArray();