Main Content


Invoke generic method of object


outargs = NET.invokeGenericMethod(obj,genericMethodName,paramTypes) calls instance or static generic method genericMethodName.

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


outargs = NET.invokeGenericMethod(obj,genericMethodName,paramTypes,args) calls generic method with specified input arguments.


collapse all

Call a generic method that takes two parameterized types and returns a parameterized type.

Assume that you have myGenericSwapMethod and it takes input arguments 5 and 6.

a = NET.invokeGenericMethod(obj,...

Input Arguments

collapse all

Object type, specified as:

  • Object of a class containing the generic method.

  • If calling a static generic method, a string or a character vector with a fully qualified class name.

  • If calling a static generic method of a generic class, a NET.GenericClass object.

Generic method name, specified as a string or a character vector.

Generic method parameterization type, specified as a variable length cell vector (1 to N), where the allowed cell types are:

  • String or character vector with fully qualified parameter type name.

  • If using nested parameterization with another parameterized type, NET.GenericClass object.

Input arguments, specified as valid argument types. args is a variable length (0 to N) list of arguments matching the arguments to the .NET generic method genericMethodName

Output Arguments

collapse all

Output arguments, returned as valid argument types. outargs is a variable length (0 to N) list of arguments matching the arguments from the .NET generic method genericMethodName.

Version History

Introduced in R2009b