Wednesday, 28 November 2012

.Net Business Connector Call a static method with dynamic parameters

Dear All
  Here a sample code for how to call a static method with a dynamic parameters because by default the CallStaticClassMethod allow you to only put max three parameters

so suppose we have a method in Axapta which is take two integer parameters and return the sum of them like this :

static int myMethod(int x,int y)
   Return x+y;

and here below is how to call this method with any number of parameters

            Dim param As Object() = New Object(1) {}
            param(0) = 3
            param(1) = 2       
            Return ax.CallStaticClassMethod("HBUnderQualityMovement", "myMethod", param)

Thanks and Regards
Happy Programming :)

No comments:

Post a Comment