Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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

  • Character vectors 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:

  • Character vectors 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

The following syntax calls 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.

Introduced in R2009b

Was this topic helpful?