Quantcast

Documentation Center

  • Trial Software
  • Product Updates

NET.invokeGenericMethod

Package: NET

Invoke generic method of object

Syntax

[varargout] = NET.invokeGenericMethod(obj, 'genericMethodName', paramTypes, args, ...)

Description

[varargout] = NET.invokeGenericMethod(obj, 'genericMethodName', paramTypes, args, ...) calls instance or static generic method genericMethodName.

Input Arguments

obj

Allowed argument types are:

  • Instances of class containing the generic method

  • Strings with fully qualified class name, if calling static generic methods

  • Instances of NET.GenericClass definitions, if calling static generic methods of a generic class

genericMethodName

Generic method name to invoke

paramTypes

Cell vector (1 to N) with the types for generic method parameterization, where allowed cell types are:

  • Strings with fully qualified parameter type name.

  • Instances of NET.GenericClass definitions, if using nested parameterization with another parameterized type

args

Optional, variable length (0 to N) list of method arguments

Output Arguments

varargout

Variable-length output argument list, varargout, from method genericMethodName

Examples

Use the following syntax to call a generic method that takes two parameterized types and returns a parameterized type:

a = NET.invokeGenericMethod(obj, ...
  'myGenericSwapMethod', ... 
  {'System.Double', 'System.Double'}, ...
  5, 6);
 

To display generic methods in MATLAB®, see the example Display .NET Generic Methods Using Reflection.

See Also

| |

Was this topic helpful?