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


C# ArrayList.add方法代码示例

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


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

示例1: VectorClassif

 public VectorClassif(int nbTags)
 {
     tagsNb = nbTags;
     ArrayList nomi = new ArrayList();
     nomi.add("0");
     nomi.add("1");
     ArrayList attr = new ArrayList();
     weka.core.Attribute stringAttr = new weka.core.Attribute("todoString", (List)null);
     attr.add(stringAttr);
     for (int i = 1; i <= nbTags; i++) {
         attr.add(new weka.core.Attribute("label" + i, nomi));
     }
     oDataSet = new Instances("Todo-Instances", attr, 500);
 }
开发者ID:KommuSoft,项目名称:MLTag,代码行数:14,代码来源:VectorClassif.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: EntityPainting

        public EntityPainting(World world, int i, int j, int k, int l)
            : this(world)
        {
            xPosition = i;
            yPosition = j;
            zPosition = k;
            var arraylist = new ArrayList();
            EnumArt[] aenumart = EnumArt.values();
            int i1 = aenumart.Length;
            for (int j1 = 0; j1 < i1; j1++)
            {
                EnumArt enumart = aenumart[j1];
                art = enumart;
                func_179_a(l);
                if (onValidSurface())
                {
                    arraylist.add(enumart);
                }
            }

            if (arraylist.size() > 0)
            {
                art = (EnumArt) arraylist.get(rand.nextInt(arraylist.size()));
            }
            func_179_a(l);
        }
开发者ID:riverar,项目名称:Crafty,代码行数:26,代码来源:EntityPainting.cs

示例4: testConstructedGenericClass

		public void testConstructedGenericClass() {
			var typeSystem = new Library(new String[] { bin });
			var typeInfo = typeSystem.getType("stab/bytecode/test/classes/GenericClass");
			var args = new ArrayList<TypeInfo>();
			args.add(typeSystem.getType("java/lang/String"));
			doTest("ConstructedGenericClass", typeSystem.getGenericType(typeInfo, args));
		}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:7,代码来源:TypeSystemTest.stab.cs

示例5: signatures

 private static ArrayList signatures([In] Class[] obj0, [In] Annotation[][] obj1)
 {
   ArrayList arrayList = new ArrayList();
   for (int index = 0; index < obj0.Length; ++index)
     arrayList.add((object) new ParameterSignature(obj0[index], obj1[index]));
   return arrayList;
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:7,代码来源:ParameterSignature.cs

示例6: clear

			public override void clear () {
				List names = new ArrayList ();
				for (Enumeration e = getAttributeNames (); e.hasMoreElements (); ) {
					names.add (e.nextElement ());
				}

				for (Iterator it = names.iterator (); it.hasNext (); ) {
					removeAttribute ((String) it.next ());
				}
			}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:10,代码来源:AbstractAttributeMap.cs

示例7: 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

示例8: getDir

        private void getDir(string dirPath)
        {
            myPath.setText("Location: " + dirPath);
            item = new ArrayList();
            path = new ArrayList();
            File f = new File(dirPath);
            File[] files = f.listFiles();

            //if (!(root.StringEquals(dirPath)))
            //if (root != dirPath)
            {
                item.add(root);
                path.add(root);
                item.add("../");
                path.add(f.getParent());
            }


            if (files != null)
                for (int i = 0; i < files.Length; i++)
                {
                    File file = files[i];

                    if (!file.isHidden() && file.canRead())
                    {
                        path.add(file.getPath());
                        if (file.isDirectory())
                        {
                            item.add(file.getName() + "/");
                        }
                        else
                        {
                            item.add(file.getName());
                        }
                    }
                }

            var fileList =
              new ArrayAdapter(this, R.layout.row, item);
            //new ArrayAdapter<String>(this, R.layout.row, item);
            setListAdapter(fileList);
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:42,代码来源:ApplicationActivity.cs

示例9: parseName

 private List parseName([In] string obj0)
 {
   ArrayList arrayList = new ArrayList();
   StringTokenizer stringTokenizer = new StringTokenizer(obj0, "/");
   while (stringTokenizer.hasMoreElements())
   {
     string str = (string) stringTokenizer.nextElement();
     if (String.instancehelper_length(str) != 0)
       arrayList.add((object) str);
   }
   return (List) arrayList;
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:12,代码来源:IOUtils.cs

示例10: onCraftGuiOpened

        public virtual void onCraftGuiOpened(ICrafting icrafting)
        {
            crafters.add(icrafting);
            var arraylist = new ArrayList();
            for (int i = 0; i < inventorySlots.size(); i++)
            {
                arraylist.add(((Slot) inventorySlots.get(i)).getStack());
            }

            icrafting.updateCraftingInventory(this, arraylist);
            updateCraftingMatrix();
        }
开发者ID:riverar,项目名称:Crafty,代码行数:12,代码来源:CraftingInventoryCB.cs

示例11: BuildListView

        void BuildListView(QStandardItemModel listModel, ListModel model)
        {
            listModel.setRowCount(model.GetItems().Count);
            listModel.setColumnCount(6);
            ArrayList list = new ArrayList();
            list.add("Extension");
            list.add("Color");
            list.add("Description");
            list.add("> Bytes");
            list.add("% Bytes");
            list.add("Files");
            listModel.setHorizontalHeaderLabels(list);
            int i = 0;
            foreach (var item in model.GetItems())
            {
                com.trolltech.qt.core.QModelIndex index = listModel.index(i, 0);
                listModel.setData(i, 0, item.Extension);
                listModel.setData(i, 1, item.Color.ToString());
                listModel.setData(i, 2, item.Description);
                listModel.setData(i, 3, ListModel.FormatSizeString(item.Bytes));
                listModel.setData(i, 4, string.Format("{0:P1}", (item.PercentBytes)));
                listModel.setData(i, 5, item.FileCount.ToString());

                i++;
            }
        }
开发者ID:joncham,项目名称:NDirStat,代码行数:26,代码来源:MainWindow.cs

示例12: parseClassSignature

 public ClassSignature parseClassSignature() {
     var result = new ClassSignature();
     if (current == '<') {
         result.formalTypeParameters = parseFormalTypeParameters();
     } else {
         result.formalTypeParameters = Collections.emptyList<TypeSignature>();
     }
     result.superclass = parseClassTypeSignature();
     var superinterfaces = new ArrayList<TypeSignature>();
     result.superinterfaces = superinterfaces;
     while (current != -1) {
         superinterfaces.add(parseClassTypeSignature());
     }
     return result;
 }
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:15,代码来源:SignatureParser.stab.cs

示例13: getData

		List<Map<String,Object>> getData ()
		{
			var list = new ArrayList<Map<String,Object>> ();
			foreach (Type type in Assembly.GetExecutingAssembly ().GetTypes ()) {
				var attrs = type.GetCustomAttributes (typeof(TestAttribute), false);
				if ((attrs == null) || (attrs.Length != 1))
					continue;

				var attr = (TestAttribute)attrs [0];
				var map = new HashMap<String,Object> ();
				map.put ("title", attr.Name);
				map.put ("type", type);
				list.add (Collections.unmodifiableMap (map));
			}
			return Collections.unmodifiableList (list);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:16,代码来源:MainActivity.cs

示例14: Main

        static void Main(string[] args)
        {
            var host = "192.168.33.12:9092";
            var topic = "test2";
            var count = 50000000;

            var prop = new Properties();
            prop.put("bootstrap.servers", host);
            prop.put("group.id", "test3");
            prop.put("auto.offset.reset", "earliest");
            prop.put("enable.auto.commit", "true");
            prop.put("auto.commit.interval.ms", "1000");
            prop.put("socket.receive.buffer.bytes", (2*1024*1024).ToString());
            prop.put("fetch.message.max.bytes", (1024*1024).ToString());

            var c = new KafkaConsumer(prop, new ByteArrayDeserializer(), new ByteArrayDeserializer());
            
            var topics = new ArrayList(1);
            topics.add(topic);
            var time = DateTime.UtcNow;
            c.subscribe(topics);
            var bytes = 0;
            var i = count;
            var recordCount = 0;
            while (i > 0)
            {
                var r = c.poll(1000);
                var records = r.records(topic);
                for (var it = records.iterator(); it.hasNext() && i > 0; i--, recordCount++)
                {
                    var rec = (ConsumerRecord)it.next();
                    var b = (byte[]) rec.value();
                    bytes += b.Length;
                }
                Console.WriteLine(recordCount);
            }
            var mb = bytes / 1024.0 / 1024.0;
            var seconds = (DateTime.UtcNow - time).TotalSeconds;
            Console.WriteLine($"{mb / seconds} MB/sec");
            Console.WriteLine($"{count / seconds} Msg/sec");
        }
开发者ID:fakefeik,项目名称:KafkaClient,代码行数:41,代码来源:Program.cs

示例15: load

		public bool load(IFile file) {
			if (file.exists()) {
				try {
					var libraries = new ArrayList<ProjectLibrary>();
					var preprocessorSymbols = new HashSet<String>();
					var outputPath = "bin";
					
					var document = XmlHelper.load(new InputStreamReader(file.getContents()));
					var nodeList = document.getElementsByTagName("library");
					int length = nodeList.getLength();
					for (int i = 0; i < length; i++) {
						var e = (Element)nodeList.item(i);
						var lib = new ProjectLibrary(e.getAttribute("name"));
						var enabled = e.getAttribute("enabled");
						lib.setEnabled(enabled.length() == 0 || !enabled.equals("false"));
						libraries.add(lib);
					}
					nodeList = document.getElementsByTagName("preprocessorSymbols");
					if (nodeList.getLength() == 1) {
						foreach (var s in nodeList.item(0).getTextContent().split(";")) {
							preprocessorSymbols.add(s.trim());
						}
					}
					nodeList = document.getElementsByTagName("outputPath");
					if (nodeList.getLength() == 1) {
						outputPath = nodeList.item(0).getTextContent();
					}
					this.Libraries = libraries;
					this.PreprocessorSymbols = preprocessorSymbols;
					this.OutputPath = outputPath;
					return true;
				} catch (Exception e) {
					Environment.logException(e);
				}
			}
			this.Libraries = Query.empty<ProjectLibrary>();
			this.PreprocessorSymbols = Query.empty<String>();
			return false;
		}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:39,代码来源:ProjectProperties.stab.cs


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