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.

Generic Classes

Create .NET generic classes, invoke .NET generic methods in MATLAB®


NET.convertArrayConvert numeric MATLAB array to .NET array
NET.createGenericCreate instance of specialized .NET generic type
NET.invokeGenericMethodInvoke generic method of object


NET.GenericClassRepresent parameterized generic type definitions


Create .NET Collections

This example uses two System.String arrays, d1 and d2, to create a generic collection list.

Convert .NET Collections to MATLAB Arrays

Use the ToArray method of the System.Collections.Generic.List class to convert a collection to an array.

Create .NET Arrays of Generic Type

This example creates a .NET array of List<Int32> generic type.

Display .NET Generic Methods Using Reflection

The showGenericMethods function, reads a .NET object or a fully qualified class name and returns a cell array of the names of the generic method in the given class or object.

.NET Generic Classes

Generics are classes and methods that have placeholders (type parameters or parameterized types) for one or more types.

Accessing Items in .NET Collections

Use the Item property of the System.Collections.Generic List class to get or set an element at a specified index.

Call .NET Generic Methods

A generic method declares one or more parameterized types.

Was this topic helpful?