Main Content

Create .NET Arrays of Generic Type

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 = 

  List<System*Int32>[] with properties:

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