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


C# System.Collections.ArrayList.ToArray方法代码示例

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


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

示例1: TestPhrasePrefix

		public virtual void  TestPhrasePrefix()
		{
			RAMDirectory indexStore = new RAMDirectory();
			IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true);
			Document doc1 = new Document();
			Document doc2 = new Document();
			Document doc3 = new Document();
			Document doc4 = new Document();
			Document doc5 = new Document();
			doc1.Add(Field.Text("body", "blueberry pie"));
			doc2.Add(Field.Text("body", "blueberry strudel"));
			doc3.Add(Field.Text("body", "blueberry pizza"));
			doc4.Add(Field.Text("body", "blueberry chewing gum"));
			doc5.Add(Field.Text("body", "piccadilly circus"));
			writer.AddDocument(doc1);
			writer.AddDocument(doc2);
			writer.AddDocument(doc3);
			writer.AddDocument(doc4);
			writer.AddDocument(doc5);
			writer.Optimize();
			writer.Close();
			
			IndexSearcher searcher = new IndexSearcher(indexStore);
			
			PhrasePrefixQuery query1 = new PhrasePrefixQuery();
			PhrasePrefixQuery query2 = new PhrasePrefixQuery();
			query1.Add(new Term("body", "blueberry"));
			query2.Add(new Term("body", "strawberry"));
			
			System.Collections.ArrayList termsWithPrefix = new System.Collections.ArrayList();
			IndexReader ir = IndexReader.Open(indexStore);
			
			// this TermEnum gives "piccadilly", "pie" and "pizza".
			System.String prefix = "pi";
			TermEnum te = ir.Terms(new Term("body", prefix + "*"));
			do 
			{
				if (te.Term().Text().StartsWith(prefix))
				{
					termsWithPrefix.Add(te.Term());
				}
			}
			while (te.Next());
			
			query1.Add((Term[]) termsWithPrefix.ToArray(typeof(Term)));
			query2.Add((Term[]) termsWithPrefix.ToArray(typeof(Term)));
			
			Hits result;
			result = searcher.Search(query1);
			Assert.AreEqual(2, result.Length());
			
			result = searcher.Search(query2);
			Assert.AreEqual(0, result.Length());
		}
开发者ID:emtees,项目名称:old-code,代码行数:54,代码来源:TestPhrasePrefixQuery.cs

示例2: QueryTermVector

		public QueryTermVector(System.String queryString, Analyzer analyzer)
		{
			if (analyzer != null)
			{
				TokenStream stream = analyzer.TokenStream("", new System.IO.StringReader(queryString));
				if (stream != null)
				{
					System.Collections.ArrayList terms = new System.Collections.ArrayList();
					try
					{
						bool hasMoreTokens = false;
						
						stream.Reset();
						TermAttribute termAtt = (TermAttribute) stream.AddAttribute(typeof(TermAttribute));
						
						hasMoreTokens = stream.IncrementToken();
						while (hasMoreTokens)
						{
							terms.Add(termAtt.Term());
							hasMoreTokens = stream.IncrementToken();
						}
						ProcessTerms((System.String[]) terms.ToArray(typeof(System.String)));
					}
					catch (System.IO.IOException e)
					{
					}
				}
			}
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:29,代码来源:QueryTermVector.cs

示例3: getAllOutputQueueData

        public virtual OutputQueueData[] getAllOutputQueueData()
        {
            System.Collections.ArrayList ary = new System.Collections.ArrayList();

            if (outputQueue.Count == 0)
                return null;
            else
            {

                System.Collections.IEnumerator ie = outputQueue.GetEnumerator();
                while (ie.MoveNext())
                {
                    OutputQueueData quedata = (OutputQueueData)((System.Collections.DictionaryEntry)ie.Current).Value;

                    ary.Add(quedata);

                }
            }

            ary.Sort();
            object[] data = ary.ToArray();

            OutputQueueData[] retobjs = new OutputQueueData[data.Length];

            for (int i = 0; i < data.Length; i++)
                retobjs[i] =(OutputQueueData)data[i];

            return retobjs;
        }
开发者ID:ufjl0683,项目名称:Center,代码行数:29,代码来源:OutPutDeviceBase.cs

示例4: InterfacesArray

        public Interface[] InterfacesArray()
        {
            System.Collections.ArrayList arrList = new System.Collections.ArrayList();
                        int i = 0;

                        while (true)
                        {
                                IntPtr cIf;
                                Interface iface;

                                cIf = UnmanagedGetInterfaceN(cNode, i);

                                if (cIf == IntPtr.Zero)
                                {
                                        //Debug.WriteLine("UnmanagedAttribute zero pointer");
                                        break;
                                }

                                iface = new Interface(cIf);
                                i++;
                                arrList.Add(iface);
                        }
                        Interface[] array = (Interface[])arrList.ToArray(typeof(Interface));

                        Debug.WriteLine("NodeList with " + i + " nodes");

                        return array;
        }
开发者ID:iamsamwood,项目名称:ENCODERS,代码行数:28,代码来源:Node.cs

示例5: StartUIACacheRequestCommand

        public StartUIACacheRequestCommand()
        {
            System.Collections.ArrayList defaultPropertiesList =
                new System.Collections.ArrayList();
            defaultPropertiesList.Add("Name");
            defaultPropertiesList.Add("AutomationId");
            defaultPropertiesList.Add("ClassName");
            defaultPropertiesList.Add("ControlType");
            defaultPropertiesList.Add("NativeWindowHandle");
            defaultPropertiesList.Add("BoundingRectangle");
            defaultPropertiesList.Add("ClickablePoint");
            defaultPropertiesList.Add("IsEnabled");
            defaultPropertiesList.Add("IsOffscreen");
            this.Property = (string[])defaultPropertiesList.ToArray(typeof(string));

            System.Collections.ArrayList defaultPatternsList =
                new System.Collections.ArrayList();
            defaultPatternsList.Add("ExpandCollapsePattern");
            defaultPatternsList.Add("InvokePattern");
            defaultPatternsList.Add("ScrollItemPattern");
            defaultPatternsList.Add("SelectionItemPattern");
            defaultPatternsList.Add("SelectionPattern");
            defaultPatternsList.Add("TextPattern");
            defaultPatternsList.Add("TogglePattern");
            defaultPatternsList.Add("ValuePattern");
            this.Pattern = (string[])defaultPatternsList.ToArray(typeof(string));

            this.Scope = "SUBTREE";

            this.Filter = "RAW";
        }
开发者ID:krisdages,项目名称:STUPS,代码行数:31,代码来源:StartUIACacheRequestCommand.cs

示例6: ProcessStartsWithPlaylist

 private object ProcessStartsWithPlaylist(string buffer)
 {
     System.Collections.ArrayList result = new System.Collections.ArrayList(5);
     foreach (string line in buffer.Split('\n'))
         if (line.StartsWith("playlist: "))
             result.Add(line.Substring(10)); // "playlist: ".Length
     return result.ToArray(typeof(string));
 }
开发者ID:stefan-j,项目名称:MPC-Streamer,代码行数:8,代码来源:Callbacks.cs

示例7: GetAvailableDestinationTables

		private string[] GetAvailableDestinationTables()
		{
			System.Collections.ArrayList result = new System.Collections.ArrayList();
			result.Add("New table");
			foreach (Altaxo.Data.DataTable table in Current.Project.DataTableCollection)
				result.Add(table.Name);

			return (string[])result.ToArray(typeof(string));
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:9,代码来源:PLSPredictValueController.cs

示例8: String_To_Bytes

 public static byte[] String_To_Bytes(string[] S)
 {
     System.Collections.ArrayList BB = new System.Collections.ArrayList();
     foreach (string s in S)
     {
         // check for empty strings
         if (!(s.Equals("")))
             BB.AddRange(String_To_Bytes(s));
         BB.Add((byte) 10); // Adds the newline character at the end of each string.
     }
     return (byte[]) BB.ToArray(typeof (byte));
 }
开发者ID:coapp,项目名称:Test,代码行数:12,代码来源:CommonLib.cs

示例9: BuildContent

 public override object[] BuildContent( int baseSequence, out int finalSequence)
 {
     int sequence = baseSequence;
     System.Collections.ArrayList batchObjects = new System.Collections.ArrayList();
     foreach (RequestObject req in _batchedRequests)
     {
         req.Sequence = sequence++;
         batchObjects.Add(req.ToRequestObject());
     }
     finalSequence = sequence;
     return new object[] { _sessionInfo.ToRequestObject(), batchObjects.ToArray(), _field2  };
 }
开发者ID:replic8tor,项目名称:Rustler,代码行数:12,代码来源:BatchRequest.cs

示例10: Array_To_Bytes

 public static byte[] Array_To_Bytes(System.Array Arr)
 {
     System.Collections.ArrayList BB = new System.Collections.ArrayList();
     foreach (var V in Arr)
     {
         string S = V.ToString();
         // check for empty strings
         if (!(S.Equals("")))
             BB.AddRange(String_To_Bytes(S));
         BB.Add((byte)10); // Adds the newline character at the end of each array item.
     }
     return (byte[]) BB.ToArray(typeof (byte));
 }
开发者ID:coapp,项目名称:Test,代码行数:13,代码来源:CommonLib.cs

示例11: SubReader

		/// <summary> Returns sub IndexReader that contains the given document id.
		/// 
		/// </summary>
		/// <param name="doc">id of document
		/// </param>
		/// <param name="reader">parent reader
		/// </param>
		/// <returns> sub reader of parent which contains the specified doc id
		/// </returns>
		public static IndexReader SubReader(int doc, IndexReader reader)
		{
			System.Collections.ArrayList subReadersList = new System.Collections.ArrayList();
			ReaderUtil.GatherSubReaders(subReadersList, reader);
			IndexReader[] subReaders = (IndexReader[]) subReadersList.ToArray(typeof(IndexReader));
			int[] docStarts = new int[subReaders.Length];
			int maxDoc = 0;
			for (int i = 0; i < subReaders.Length; i++)
			{
				docStarts[i] = maxDoc;
				maxDoc += subReaders[i].MaxDoc();
			}
			return subReaders[ReaderUtil.SubIndex(doc, docStarts)];
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:23,代码来源:ReaderUtil.cs

示例12: DecryptString

 /**************************************************�ַ��������㷨**************************************************/
 public static string DecryptString(string str)
 {
     if ((str.Length % 4) != 0)
     {
         throw new ArgumentException("������ȷ��BASE64���룬���顣", "str");
     }
     if (!System.Text.RegularExpressions.Regex.IsMatch(str, "^[A-Z0-9/+=]*$", System.Text.RegularExpressions.RegexOptions.IgnoreCase))
     {
         throw new ArgumentException("��������ȷ��BASE64���룬���顣", "str");
     }
     string Base64Code = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=";
     int page = str.Length / 4;
     System.Collections.ArrayList outMessage = new System.Collections.ArrayList(page * 3);
     char[] message = str.ToCharArray();
     for (int i = 0; i < page; i++)
     {
         byte[] instr = new byte[4];
         instr[0] = (byte)Base64Code.IndexOf(message[i * 4]);
         instr[1] = (byte)Base64Code.IndexOf(message[i * 4 + 1]);
         instr[2] = (byte)Base64Code.IndexOf(message[i * 4 + 2]);
         instr[3] = (byte)Base64Code.IndexOf(message[i * 4 + 3]);
         byte[] outstr = new byte[3];
         outstr[0] = (byte)((instr[0] << 2) ^ ((instr[1] & 0x30) >> 4));
         if (instr[2] != 64)
         {
             outstr[1] = (byte)((instr[1] << 4) ^ ((instr[2] & 0x3c) >> 2));
         }
         else
         {
             outstr[2] = 0;
         }
         if (instr[3] != 64)
         {
             outstr[2] = (byte)((instr[2] << 6) ^ instr[3]);
         }
         else
         {
             outstr[2] = 0;
         }
         outMessage.Add(outstr[0]);
         if (outstr[1] != 0)
             outMessage.Add(outstr[1]);
         if (outstr[2] != 0)
             outMessage.Add(outstr[2]);
     }
     byte[] outbyte = (byte[])outMessage.ToArray(Type.GetType("System.Byte"));
     return System.Text.Encoding.Default.GetString(outbyte);
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:49,代码来源:Base64EncryptDecrypt.cs

示例13: GetProperties

        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            //var cols = base.GetProperties();
            var dictionary = value as IDictionary<String, object>;
            var properties = new System.Collections.ArrayList();
            foreach (var e in dictionary)
            {
                properties.Add(new DictionaryPropertyDescriptor(dictionary, e.Key));
                if (e.Value != null)
                    TypeDescriptorModifier.modifyType(e.Value.GetType());
            }

            PropertyDescriptor[] props =
                (PropertyDescriptor[])properties.ToArray(typeof(PropertyDescriptor));

            return new PropertyDescriptorCollection(props);
        }
开发者ID:nkarastamatis,项目名称:WebServiceTestStudio_Winforms,代码行数:17,代码来源:ExpandoObjectConverter.cs

示例14: NullTermPtrToStringArray

    public static string[] NullTermPtrToStringArray (IntPtr null_term_array, bool owned) {
      if (null_term_array == IntPtr.Zero)
        return new string [0];

      int count = 0;
      System.Collections.ArrayList result = new System.Collections.ArrayList ();
      IntPtr s = Marshal.ReadIntPtr (null_term_array, count++ * IntPtr.Size);
      while (s != IntPtr.Zero) {
        result.Add (Gst.GLib.Marshaller.Utf8PtrToString (s));
        s = Marshal.ReadIntPtr (null_term_array, count++ * IntPtr.Size);
      }

      if (owned)
        g_strfreev (null_term_array);

      return (string[]) result.ToArray (typeof (string));
    }
开发者ID:jwzl,项目名称:ossbuild,代码行数:17,代码来源:Marshaller.cs

示例15: GetSourceSystems

        /// <summary>
        /// Get list of unique SourceSystem values present in the collection
        /// </summary>
        /// <returns></returns>
        public BusinessObjects.WorkManagement.eWMSourceSystem[] GetSourceSystems()
        {
            BusinessObjects.WorkManagement.eWMSourceSystem[] arrPropertyValues = null;
            System.Collections.ArrayList colPropertyValues = new System.Collections.ArrayList();

            foreach (AssignmentDetails objDetails in this)
            {
                if (colPropertyValues.IndexOf(objDetails.SourceSystem) < 0)
                {
                    colPropertyValues.Add(objDetails.SourceSystem);
                }
            }

            if (colPropertyValues.Count > 0)
            {
                arrPropertyValues = (BusinessObjects.WorkManagement.eWMSourceSystem[])colPropertyValues.ToArray(typeof(BusinessObjects.WorkManagement.eWMSourceSystem));
            }

            return arrPropertyValues;
        }
开发者ID:bedford603067,项目名称:Augment,代码行数:24,代码来源:AssignmentDetails.cs


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