Description

Calls a public method of a specified object or type.



Attributes

Misc

  • DisplayName - Renames the activity.

  • GenericTypeArguments - Collection

  • MethodName - The name of the method to be called when the activity executes.

  • Parameters - The parameter collection of the called method.

  • Result - The return value of the method call.

  • RunAsynchronously - Specifies whether the method is called asynchronously. The default value is False.

  • TargetObject - The object that contains the method to call.

  • TargetType - The type of TargetObject.


Example

  1. Create a DataSet variable called ds, and a DataTable variable called dt.
  2. Add an Assign activity inside a Sequence.
  3. In the To field, write ds, and in the Value field, write new DataSet().
  4. Add another Assign activity.
  5. In the To field, write dt, and in the Value field, write new DataTable("Sample Table Name").
  6. Add a Generate Data Table activity, and in DataTable field under Properties, add dt.
  7. In the ColumnSeparators field, type ";", and in the NewLineSeparator, write "|".
  8. In the Input field, write "1; Nicole|2; John" (or whatever values you prefer).
  9. Add an InvokeMethod activity.
  10. In the Parameters under Properties, add an Argument.
  11. Set the Value of the argument to dt and its Type to DataTable, and then Click OK.
  12. In the TargetObject field, type ds.Tables.
  13. In the MethodName, write Add.
  14. Add a Write Line activity.
  15. In the Text field, write ds.Tables(0).rows.Count.ToString()


        The use case should look as the following screenshot:




After generating a Data Table, it is added into the ds variable by using InvokeMethod, and then the rows count of the first Data Table in the DataSet is displayed using Write Line. The output should look like this in the Output panel: