当前位置: 首页>>代码示例>>C#>>正文


C# ArrayList.toArray方法代码示例

本文整理汇总了C#中java.util.ArrayList.toArray方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.toArray方法的具体用法?C# ArrayList.toArray怎么用?C# ArrayList.toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.ArrayList的用法示例。


在下文中一共展示了ArrayList.toArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: sort

    public static void sort(List modules)
    {
      HashMap hashMap = new HashMap();
      ArrayList arrayList1 = new ArrayList();
      ArrayList arrayList2 = new ArrayList();
      for (int index = 0; index < modules.size(); ++index)
      {
        PackageState packageState = (PackageState) modules.get(index);
        if (packageState.getState() == -2)
        {
          arrayList1.add((object) packageState);
        }
        else
        {
          PackageSorter.SortModule sortModule = new PackageSorter.SortModule(packageState);
          arrayList2.add((object) sortModule);
          hashMap.put((object) packageState.getModule().getModuleClass(), (object) sortModule);
        }
      }
      PackageSorter.SortModule[] sortModuleArray = (PackageSorter.SortModule[]) arrayList2.toArray((object[]) new PackageSorter.SortModule[arrayList2.size()]);
      for (int index = 0; index < sortModuleArray.Length; ++index)
      {
        PackageSorter.SortModule sortModule = sortModuleArray[index];
        sortModule.setDependSubsystems(PackageSorter.collectSubsystemModules(sortModule.getState().getModule(), hashMap));
      }
      int num1 = 1;
label_10:
      while (num1 != 0)
      {
        num1 = 0;
        int index = 0;
        while (true)
        {
          if (index < sortModuleArray.Length)
          {
            PackageSorter.SortModule sortModule = sortModuleArray[index];
            int num2 = PackageSorter.searchModulePosition(sortModule, hashMap);
            if (num2 != sortModule.getPosition())
            {
              sortModule.setPosition(num2);
              num1 = 1;
            }
            ++index;
          }
          else
            goto label_10;
        }
      }
      Arrays.sort((object[]) sortModuleArray);
      modules.clear();
      for (int index = 0; index < sortModuleArray.Length; ++index)
        modules.add((object) sortModuleArray[index].getState());
      for (int index = 0; index < arrayList1.size(); ++index)
        modules.add(arrayList1.get(index));
    }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:55,代码来源:PackageSorter.cs

示例2: getDependencies

 public virtual BootableProjectInfo[] getDependencies()
 {
   ArrayList arrayList = new ArrayList();
   foreach (Library library in this.getLibraries())
   {
     if (library is BootableProjectInfo)
       arrayList.add((object) library);
   }
   foreach (Library library in this.getOptionalLibraries())
   {
     if (library is BootableProjectInfo)
       arrayList.add((object) library);
   }
   return (BootableProjectInfo[]) arrayList.toArray((object[]) new BootableProjectInfo[arrayList.size()]);
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:15,代码来源:BootableProjectInfo.cs

示例3: getActiveModules

 public virtual Module[] getActiveModules()
 {
   ArrayList arrayList = new ArrayList();
   for (int index = 0; index < this.modules.size(); ++index)
   {
     PackageState packageState = (PackageState) this.modules.get(index);
     if (packageState.getState() == 2)
       arrayList.add((object) packageState.getModule());
   }
   return (Module[]) arrayList.toArray((object[]) new Module[arrayList.size()]);
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:11,代码来源:PackageManager.cs

示例4: getOptionalLibraries

 public virtual Library[] getOptionalLibraries()
 {
   ArrayList arrayList = new ArrayList();
   for (int index = 0; index < this.optionalLibraries.size(); ++index)
   {
     Library library = ((BasicProjectInfo.OptionalLibraryHolder) this.optionalLibraries.get(index)).getLibrary();
     if (library != null)
       arrayList.add((object) library);
   }
   return (Library[]) arrayList.toArray((object[]) new Library[arrayList.size()]);
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:11,代码来源:BasicProjectInfo.cs

示例5: parseVersions

 private static string[] parseVersions([In] string obj0)
 {
   if (obj0 == null)
     return new string[0];
   ArrayList arrayList = new ArrayList();
   StringTokenizer stringTokenizer = new StringTokenizer(obj0, ".");
   while (stringTokenizer.hasMoreTokens())
     arrayList.add((object) stringTokenizer.nextToken());
   return (string[]) arrayList.toArray((object[]) new string[arrayList.size()]);
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:10,代码来源:ObjectUtilities.cs

示例6: removeTarget

 public virtual void removeTarget(LogTarget target)
 {
   if (target == null)
   {
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new NullPointerException();
   }
   else
   {
     ArrayList arrayList = new ArrayList();
     arrayList.addAll((Collection) Arrays.asList((object[]) this.logTargets));
     arrayList.remove((object) target);
     LogTarget[] logTargetArray = new LogTarget[arrayList.size()];
     this.logTargets = (LogTarget[]) arrayList.toArray((object[]) logTargetArray);
   }
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:16,代码来源:Log.cs


注:本文中的java.util.ArrayList.toArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。