Skip to Main Content Skip to Search
Product Documentation

NET.createArray - Package: NET

Array for nonprimitive .NET types

Syntax

array = NET.createArray(typeName, [m,n,p,...])
array = NET.createArray(typeName, m,n,p,...)

Description

array = NET.createArray(typeName, [m,n,p,...]) creates an m-by-n-by-p-by-... array of type typeName, which is either a fully qualified .NET array type name (namespace and array type name) or an instance of the NET.GenericClass class, in case of arrays of generic type. m,n,p,... are the number of elements in each dimension of the array.

array = NET.createArray(typeName, m,n,p,...) alternative syntax for creating an array.

You cannot specify the lower bound of an array or create a jagged array.

Examples

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

genType = NET.GenericClass('System.Collections.Generic.List',...
  'System.Int32'); 
arr = NET.createArray(genType, 5)
arr = 

  System.Collections.Generic.List<System*Int32>[] handle 
  Package: System.Collections.Generic 

  Properties: 
            Length: 5 
        LongLength: 5 
              Rank: 1 
          SyncRoot: [1x1 System.Collections.Generic.List<System*Int32>[]] 
        IsReadOnly: 0 
       IsFixedSize: 1 
    IsSynchronized: 0 

  Methods, Events, Superclasses 

See Also

NET.convertArray | NET.createGeneric

  


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