Skip to Main Content Skip to Search
Product Documentation

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

NET.createGeneric | NET.GenericClass | varargout

How To

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS