當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。