本文整理汇总了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());
}
示例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)
{
}
}
}
}
示例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;
}
示例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;
}
示例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";
}
示例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));
}
示例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));
}
示例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));
}
示例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 };
}
示例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));
}
示例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)];
}
示例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);
}
示例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);
}
示例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));
}
示例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;
}