本文整理汇总了C#中System.Collections.ArrayList.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ArrayList.CopyTo方法的具体用法?C# System.Collections.ArrayList.CopyTo怎么用?C# System.Collections.ArrayList.CopyTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ArrayList
的用法示例。
在下文中一共展示了System.Collections.ArrayList.CopyTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getHL7Messages
/// <summary> Given a string that contains HL7 messages, and possibly other junk,
/// returns an array of the HL7 messages.
/// An attempt is made to recognize segments even if there is other
/// content between segments, for example if a log file logs segments
/// individually with timestamps between them.
///
/// </summary>
/// <param name="theSource">a string containing HL7 messages
/// </param>
/// <returns> the HL7 messages contained in theSource
/// </returns>
private static System.String[] getHL7Messages(System.String theSource)
{
System.Collections.ArrayList messages = new System.Collections.ArrayList(20);
Match startMatch = new Regex("^MSH", RegexOptions.Multiline).Match(theSource);
foreach (Group group in startMatch.Groups)
{
System.String messageExtent = getMessageExtent(theSource.Substring(group.Index), "^MSH");
char fieldDelim = messageExtent[3];
Match segmentMatch = Regex.Match(messageExtent, "^[A-Z]{3}\\" + fieldDelim + ".*$", RegexOptions.Multiline);
System.Text.StringBuilder msg = new System.Text.StringBuilder();
foreach (Group segGroup in segmentMatch.Groups)
{
msg.Append(segGroup.Value.Trim());
msg.Append('\r');
}
messages.Add(msg.ToString());
}
String[] retVal = new String[messages.Count];
messages.CopyTo(retVal);
return retVal;
}
示例2: FormatMailToCommand
/// <summary>
///
/// </summary>
/// <param name="p_To">null if not used</param>
/// <param name="p_Cc">null if not used</param>
/// <param name="p_Bcc">null if not used</param>
/// <param name="p_Subject">null if not used</param>
/// <param name="p_Body">null if not used</param>
/// <returns></returns>
public static string FormatMailToCommand(string[] p_To, string[] p_Cc, string[] p_Bcc, string p_Subject, string p_Body)
{
string l_To = FormatEMailAddress(p_To);
string l_CC = FormatEMailAddress(p_Cc);
string l_Bcc = FormatEMailAddress(p_Bcc);
string l_Command = "mailto:";
if (l_To!=null)
l_Command+=l_To;
System.Collections.ArrayList l_Parameters = new System.Collections.ArrayList();
if (l_CC!=null)
l_Parameters.Add("CC="+l_CC);
if (l_Bcc!=null)
l_Parameters.Add("BCC="+l_Bcc);
if (p_Subject!=null)
l_Parameters.Add("subject="+p_Subject);
if (p_Body!=null)
l_Parameters.Add("body="+p_Body);
if (l_Parameters.Count>0)
{
string[] l_tmp = new string[l_Parameters.Count];
l_Parameters.CopyTo(l_tmp,0);
l_Command+="?";
l_Command+=string.Join("&",l_tmp);
}
return l_Command;
}
示例3: GetLuceneIndexFiles
/// <summary>
/// Returns a list of files in a give directory.
/// </summary>
/// <param name="fullName">The full path name to the directory.</param>
/// <param name="indexFileNameFilter"></param>
/// <returns>An array containing the files.</returns>
public static System.String[] GetLuceneIndexFiles(System.String fullName,
Index.IndexFileNameFilter indexFileNameFilter)
{
System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(fullName);
System.Collections.ArrayList list = new System.Collections.ArrayList();
foreach (System.IO.FileInfo fInfo in dInfo.GetFiles())
{
if (indexFileNameFilter.Accept(fInfo, fInfo.Name) == true)
{
list.Add(fInfo.Name);
}
}
System.String[] retFiles = new System.String[list.Count];
list.CopyTo(retFiles);
return retFiles;
}
示例4: ReadObject
public override object ReadObject(XmlReader reader)
{
ArrayOfLoanStateCompositeType ArrayOfLoanStateCompositeTypeField = null;
if (IsParentStartElement(reader, false, true))
{
ArrayOfLoanStateCompositeTypeField = new ArrayOfLoanStateCompositeType();
reader.Read();
LoanStateCompositeTypeDataContractSerializer LoanStateCompositeTypeDCS = new LoanStateCompositeTypeDataContractSerializer("LoanStateCompositeType", "http://schemas.datacontract.org/2004/07/", "http://schemas.datacontract.org/2004/07/");
System.Collections.ArrayList LoanStateCompositeType_List = new System.Collections.ArrayList();
for (int i = 0; (i > -1); i = (i + 1))
{
if (!IsChildStartElement(reader, "LoanStateCompositeType", false, false))
{
ArrayOfLoanStateCompositeTypeField.LoanStateCompositeType = new LoanStateCompositeType[LoanStateCompositeType_List.Count];
LoanStateCompositeType_List.CopyTo(ArrayOfLoanStateCompositeTypeField.LoanStateCompositeType);
break;
}
LoanStateCompositeType_List.Add(((LoanStateCompositeType)(LoanStateCompositeTypeDCS.ReadObject(reader))));
}
reader.ReadEndElement();
}
return ArrayOfLoanStateCompositeTypeField;
}
示例5: SplitString
/// <summary>
/// Split string according the dilimer, this function is equea to
/// String.Split(char[], StringSplitOptions.RemoveEmptyEntries)
/// which is not supported by .net cf
/// </summary>
/// <param name="splitStr"></param>
/// <returns></returns>
public static string[] SplitString(string str, char[] separator)
{
string[] splitStr = str.Split(separator);
System.Collections.ArrayList list = new System.Collections.ArrayList();
for (int i = 0; i < splitStr.Length; i++)
{
if (splitStr[i] != string.Empty && splitStr[i] != null)
{
list.Add(splitStr[i]);
}
}
splitStr = new string[list.Count];
list.CopyTo(splitStr);
return splitStr;
}
示例6: Split
public string[] Split(string expression, string delimiter, string qualifier, bool ignoreCase)
{
bool _QualifierState = false;
int _StartIndex = 0;
System.Collections.ArrayList _Values = new System.Collections.ArrayList();
for (int _CharIndex = 0; _CharIndex < expression.Length - 1; _CharIndex++)
{
if ((qualifier != null)
& (string.Compare(expression.Substring
(_CharIndex, qualifier.Length), qualifier, ignoreCase) == 0))
{
_QualifierState = !(_QualifierState);
}
else if (!(_QualifierState) & (delimiter != null)
& (string.Compare(expression.Substring
(_CharIndex, delimiter.Length), delimiter, ignoreCase) == 0))
{
_Values.Add(expression.Substring
(_StartIndex, _CharIndex - _StartIndex));
_StartIndex = _CharIndex + 1;
}
}
if (_StartIndex < expression.Length)
_Values.Add(expression.Substring
(_StartIndex, expression.Length - _StartIndex));
string[] _returnValues = new string[_Values.Count];
_Values.CopyTo(_returnValues);
return _returnValues;
}
示例7: ProcessHoldingResponse
private string[] ProcessHoldingResponse(string xmlResponse)
{
System.Collections.ArrayList alist = new System.Collections.ArrayList();
string sMessage = "";
System.Xml.XmlDocument objXML = new System.Xml.XmlDocument();
objXML.LoadXml(xmlResponse);
System.Xml.XmlNamespaceManager nsmgr = new System.Xml.XmlNamespaceManager(objXML.NameTable);
nsmgr.AddNamespace("x", "http://www.w3.org/2005/Atom");
nsmgr.AddNamespace("os", "http://a9.com/-/spec/opensearch/1.1/");
nsmgr.AddNamespace("oclc", "http://worldcat.org/rb/holdinglibrary");
sMessage = "";
System.Xml.XmlNodeList nodes = objXML.SelectNodes("/x:feed/x:entry", nsmgr);
if (nodes != null)
{
foreach (System.Xml.XmlNode node in nodes)
{
sMessage = node.SelectSingleNode("x:content/oclc:library/oclc:holdingCode", nsmgr).InnerText;
alist.Add(sMessage);
}
}
if (alist.Count > 0)
{
string[] arrOut = new string[alist.Count];
alist.CopyTo(arrOut);
return arrOut;
}
return null;
}
示例8: GetWindows
public CarverLabUtility.Window[] GetWindows()
{
alWindowArray = new System.Collections.ArrayList();
CarverLabUtility.Win32Wrapper myWrap = new CarverLabUtility.Win32Wrapper();
myWrap.EnumWindowsExReceived += new EnumWindowsExProc(GetWindows_EnumWindowsExReceived);
myWrap.EnumWindowsEx(null);
if (alWindowArray.Count > 0)
{
WindowArray = new CarverLabUtility.Window[alWindowArray.Count];
alWindowArray.CopyTo(WindowArray);
}
return WindowArray;
}
示例9: List
public ProductDetails[] List(int BranchID = 0)
{
try
{
System.Collections.ArrayList items = new System.Collections.ArrayList();
System.Data.DataTable dtProductIDs = ProductIDAsDataTable();
foreach (System.Data.DataRow drProductID in dtProductIDs.Rows)
{
items.Add(Details1(BranchID, long.Parse(drProductID["ProductID"].ToString())));
}
ProductDetails[] arrProductDetails = new ProductDetails[0];
if (items != null)
{
arrProductDetails = new ProductDetails[items.Count];
items.CopyTo(arrProductDetails);
}
return arrProductDetails;
}
catch (Exception ex)
{
throw base.ThrowException(ex);
}
}
示例10: EmmitPatch
public static void EmmitPatch(string address,string endaddress) {
int start=HexParse(address);
int end=HexParse(endaddress);
Process p=new Process();
p.StartInfo.FileName="nasm.exe";
p.StartInfo.Arguments="patch.asm";
p.StartInfo.UseShellExecute=false;
p.StartInfo.CreateNoWindow=true;
p.Start();
p.WaitForExit();
FileInfo fi=new FileInfo("patch");
if(fi.Length==0) throw new Exception("Patcher: Code generator produced uncompilable code");
ArrayList al=new ArrayList(ReadFileBytes("patch"));
byte[] b=new byte[end-start];
al.CopyTo(b);
for(int i=al.Count;i<b.Length;i++) {
b[i]=144;
}
int a=(end-start)-al.Count;
if(a>127) {
b[al.Count]=235;
b[al.Count+1]=127;
//throw new OptimizationException("Patcher: Patch end address out of range of a short jump");
} else if(a>2) {
b[al.Count]=235;
b[al.Count+1]=(byte)(a-2);
}
BinaryWriter bw=new BinaryWriter(File.Create("emittedpatch.patch",4096));
bw.Write(HexParse(address));
bw.Write(b.Length);
bw.Write(b,0,b.Length);
bw.Close();
}
示例11: testAll
/// <summary> Tests all remaining messages available from the currrent source.</summary>
public virtual NuGenHL7Exception[] testAll()
{
System.Collections.ArrayList list = new System.Collections.ArrayList();
System.String message = null;
while ((message = NextMessage).Length > 0)
{
NuGenHL7Exception e = parsesCorrectly(this.context, message);
if (e != null)
list.Add(e);
}
NuGenHL7Exception[] retVal = new NuGenHL7Exception[list.Count];
list.CopyTo(retVal);
return retVal;
}
示例12: ReadObject
public override object ReadObject(XmlReader reader)
{
ArrayOfFileInfo ArrayOfFileInfoField = null;
if (IsParentStartElement(reader, false, true))
{
ArrayOfFileInfoField = new ArrayOfFileInfo();
reader.Read();
FileInfoDataContractSerializer FileInfoDCS = new FileInfoDataContractSerializer("FileInfo", "http://schemas.datacontract.org/2004/07/WcfMtomService", "http://schemas.datacontract.org/2004/07/WcfMtomService");
System.Collections.ArrayList FileInfo_List = new System.Collections.ArrayList();
for (int i = 0; (i > -1); i = (i + 1))
{
if (!IsChildStartElement(reader, "FileInfo", false, false))
{
ArrayOfFileInfoField.FileInfo = new FileInfo[FileInfo_List.Count];
FileInfo_List.CopyTo(ArrayOfFileInfoField.FileInfo);
break;
}
FileInfo_List.Add(((FileInfo)(FileInfoDCS.ReadObject(reader))));
}
reader.ReadEndElement();
}
return ArrayOfFileInfoField;
}
示例13: getPrimitiveRules
/// <seealso cref="Genetibase.NuGenHL7.validation.ValidationContext.getDataTypeRules(java.lang.String, java.lang.String)">
/// </seealso>
/// <param name="theType">ignored
/// </param>
public virtual NuGenPrimitiveTypeRule[] getPrimitiveRules(System.String theVersion, System.String theTypeName, Primitive theType)
{
System.Collections.IList active = new System.Collections.ArrayList(myPrimitiveRuleBindings.Count);
for (int i = 0; i < myPrimitiveRuleBindings.Count; i++)
{
System.Object o = myPrimitiveRuleBindings[i];
if (!(o is NuGenRuleBinding))
{
throw new System.InvalidCastException("Item in rule binding list is not a RuleBinding");
}
NuGenRuleBinding binding = (NuGenRuleBinding) o;
if (binding.Active && binding.appliesToVersion(theVersion) && binding.appliesToScope(theTypeName))
{
active.Add(binding.Rule);
}
}
NuGenPrimitiveTypeRule[] retVal = new NuGenPrimitiveTypeRule[active.Count];
active.CopyTo(retVal, 0);
return retVal;
}
示例14: GetMultiselectFiles
/// <include file='doc\FileDialog.uex' path='docs/doc[@for="FileDialog.GetMultiselectFiles"]/*' />
/// <devdoc>
/// Extracts the filename(s) returned by the file dialog.
/// </devdoc>
private string[] GetMultiselectFiles(CharBuffer charBuffer) {
string directory = charBuffer.GetString();
string fileName = charBuffer.GetString();
if (fileName.Length == 0) return new string[] {
directory
};
if (directory[directory.Length - 1] != '\\') {
directory = directory + "\\";
}
ArrayList names = new ArrayList();
do {
if (fileName[0] != '\\' && (fileName.Length <= 3 ||
fileName[1] != ':' || fileName[2] != '\\')) {
fileName = directory + fileName;
}
names.Add(fileName);
fileName = charBuffer.GetString();
} while (fileName.Length > 0);
string[] temp = new string[names.Count];
names.CopyTo(temp, 0);
return temp;
}
示例15: GetAllDateTimes
internal static String[] GetAllDateTimes(DateTime dateTime, DateTimeFormatInfo dtfi)
{
ArrayList results = new ArrayList(DEFAULT_ALL_DATETIMES_SIZE);
for (int i = 0; i < allStandardFormats.Length; i++)
{
String[] strings = GetAllDateTimes(dateTime, allStandardFormats[i], dtfi);
for (int j = 0; j < strings.Length; j++)
{
results.Add(strings[j]);
}
}
String[] value = new String[results.Count];
results.CopyTo(0, value, 0, results.Count);
return (value);
}