Main Content

创建泛型类型的 .NET 数组

此示例创建一个 .NET List<Int32> 泛型类型数组。

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