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


C# ArrayList.toArray方法代码示例

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


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

示例1: ParameterList

	// TODO checks
	public ParameterList(InputPacket packet)   {
		super(0);
		// array lists in which store parameters
		ArrayList parameters = new ArrayList();
		
		bool stop = false;
		do {
			// at least 4 bytes for length and type
			if (packet.getCursorPosition() + 4 <= packet.getLength()) {
				short parameterId = packet.read_short();
				short length = packet.read_short();
				byte[] p = new byte[length];
				if (parameterId != PID_SENTINEL) {
					for (int i=0; i<length; i++) {
						p[i] = packet.read_octet();
					}
					parameters.add(new Parameter(parameterId,length,p));
				}
				else {
					stop = true;
				}
			}
			else {
				throw  new MalformedSubmessageElementException("ParameterList too short");
			}
		} while (!stop);
		
		value = new Parameter[parameters.size()];
		parameters.toArray(value);
	}	
开发者ID:Egipto87,项目名称:DOOP.ec,代码行数:31,代码来源:ParameterList.cs

示例2: getFileBlockLocations

 public BlockLocation[] getFileBlockLocations(FileStatus stat,
                                              long start, long len) {
   List<BlockLocation> result = new ArrayList<BlockLocation>();
   for(MockFile file: files) {
     if (file.path.equals(stat.getPath())) {
       for(MockBlock block: file.blocks) {
         if (OrcInputFormat.SplitGenerator.getOverlap(block.offset,
             block.length, start, len) > 0) {
           String[] topology = new String[block.hosts.length];
           for(int i=0; i < topology.length; ++i) {
             topology[i] = "/rack/ " + block.hosts[i];
           }
           result.add(new BlockLocation(block.hosts, block.hosts,
               topology, block.offset, block.length));
         }
       }
       return result.toArray(new BlockLocation[result.size()]);
     }
   }
   return new BlockLocation[0];
 }
开发者ID:CurtHagenlocher,项目名称:OrcSharp,代码行数:21,代码来源:TestInputOutputFormat.cs

示例3: listStatus

 public FileStatus[] listStatus(Path path) {
   path = path.makeQualified(this);
   List<FileStatus> result = new ArrayList<FileStatus>();
   String pathname = path.toString();
   String pathnameAsDir = pathname + "/";
   Set<String> dirs = new TreeSet<String>();
   for(MockFile file: files) {
     String filename = file.path.toString();
     if (pathname.equals(filename)) {
       return new FileStatus[]{createStatus(file)};
     } else if (filename.startsWith(pathnameAsDir)) {
       String tail = filename.substring(pathnameAsDir.length());
       int nextSlash = tail.indexOf('/');
       if (nextSlash > 0) {
         dirs.add(tail.substring(0, nextSlash));
       } else {
         result.add(createStatus(file));
       }
     }
   }
   // for each directory add it once
   for(String dir: dirs) {
     result.add(createDirectory(new MockPath(this, pathnameAsDir + dir)));
   }
   return result.toArray(new FileStatus[result.size()]);
 }
开发者ID:CurtHagenlocher,项目名称:OrcSharp,代码行数:26,代码来源:TestInputOutputFormat.cs


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