C# Reflection Invoke - Object of Type 'XXX' Cannot Be Converted to type 'System.Object[]' -


I created an example named input which is of type:

< Pre> Public Class TestInPant {Public Ink TesTInt {get; Set; }}

I use this in this function:

  public static class testclass {public static string testfunction () {var testInput = New TestInput ( ); String res = ServicesManager.Execute & lt; String & gt; ((Object) testInput); Return ridge; }}  

Execute function is here:

  Execute public statics & lt; OUT> (Object input) where out: class {var method = // get method by reflection object [arr arr] = new object [] {input}; Return method Out as Invoc (blank, AR); // error has been started}  

This method I say is:

  public static string TestFunctionProxy (object [] input) {Var serviceInput = TestInput as input [0]; // code rest of code}  

I got an error in the title (XXX - "test input" type)

What is happening and what is the reason for this error?

Note: method is constant, so there is no frequency required for the first parameter please correct me if I am wrong.

Any help is appreciated.

Edit: Updated the question with some more code for a complete example. / P>

You are misinterpreting the method. It wants an object [] and you are giving the same object the way to correct it:

  object [arr] arr = new object [] {new object [] {input} };  

The 'external' object [] is the parameter for the invitation, the 'inner' array is the parameter of your method.


Comments