本文整理汇总了C#中System.Collections.ArrayList类的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ArrayList类的具体用法?C# System.Collections.ArrayList怎么用?C# System.Collections.ArrayList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Collections.ArrayList类属于命名空间,在下文中一共展示了System.Collections.ArrayList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: insertToDB
private int insertToDB()
{
DTO.Invoice invoice = new DTO.Invoice();
System.Collections.ArrayList details = new System.Collections.ArrayList();
for (int i = 0; i < grdItems.Rows.Count; i++)
{
DTO.InvoiceDetail d = new DTO.InvoiceDetail();
DTO.Product p = new DTO.Product();
p.Productid = int.Parse(grdItems.Rows[i].Cells[7].Value.ToString());
d.Quantity = int.Parse(grdItems.Rows[i].Cells[2].Value.ToString());
d.Priceout = decimal.Parse(grdItems.Rows[i].Cells[3].Value.ToString());
d.Dicount = decimal.Parse(grdItems.Rows[i].Cells[4].Value.ToString());
d.Pricein = decimal.Parse(grdItems.Rows[i].Cells[8].Value.ToString());
d.Product = p;
details.Add(d);
}
DTO.Member member = new DTO.Member();
member.Memberid = (int)cboMember.SelectedValue; ///
invoice.Staff = UserSession.Session.Staff;
invoice.Member = member;
invoice.Remark = "";
invoice.Discount = decimal.Parse(txtDiscount.Text.Replace("%", "").Replace(" ",""));
invoice.InvoiceDetail = details;
return new DAO.InvoiceDAO().addInvoice(invoice);
}
示例2: TestExecute
public void TestExecute()
{
SpreadsheetCompiler converter = new SpreadsheetCompiler();
System.IO.Stream stream = Assembly.GetAssembly(this.GetType()).GetManifestResourceStream("org.drools.dotnet.examples.resources.data.IntegrationExampleTest.xls");
System.String drl = converter.Compile(stream, InputType.XLS);
Assert.IsNotNull(drl);
//COMPILE
PackageBuilder builder = new PackageBuilder();
builder.AddPackageFromDrl(drl);
Package pkg = builder.GetPackage();
Assert.IsNotNull(pkg);
System.Console.Out.WriteLine(pkg.GetErrorSummary());
Assert.AreEqual(0, builder.GetErrors().Length);
RuleBase rb = RuleBaseFactory.NewRuleBase();
rb.AddPackage(pkg);
WorkingMemory wm = rb.NewWorkingMemory();
//ASSERT AND FIRE
wm.assertObject(new Cheese("stilton", 42));
wm.assertObject(new Person("michael", "stilton", 42));
System.Collections.IList list = new System.Collections.ArrayList();
wm.setGlobal("list", list);
wm.fireAllRules();
Assert.AreEqual(1, list.Count);
}
示例3: PerformPathping
/// <summary>
/// Performs a pathping
/// </summary>
/// <param name="ipaTarget">The target</param>
/// <param name="iHopcount">The maximum hopcount</param>
/// <param name="iTimeout">The timeout for each ping</param>
/// <returns>An array of PingReplys for the whole path</returns>
public static PingReply[] PerformPathping(IPAddress ipaTarget, int iHopcount, int iTimeout)
{
System.Collections.ArrayList arlPingReply = new System.Collections.ArrayList();
Ping myPing = new Ping();
PingReply prResult = null;
int iTimeOutCnt = 0;
for (int iC1 = 1; iC1 < iHopcount && iTimeOutCnt<5; iC1++)
{
prResult = myPing.Send(ipaTarget, iTimeout, new byte[10], new PingOptions(iC1, false));
if (prResult.Status == IPStatus.Success)
{
iC1 = iHopcount;
iTimeOutCnt = 0;
}
else if (prResult.Status == IPStatus.TtlExpired)
{
iTimeOutCnt = 0;
}
else if (prResult.Status == IPStatus.TimedOut)
{
iTimeOutCnt++;
}
arlPingReply.Add(prResult);
}
PingReply[] prReturnValue = new PingReply[arlPingReply.Count];
for (int iC1 = 0; iC1 < arlPingReply.Count; iC1++)
{
prReturnValue[iC1] = (PingReply)arlPingReply[iC1];
}
return prReturnValue;
}
示例4: MultiFormatOneDReader
public MultiFormatOneDReader(System.Collections.Hashtable hints)
{
System.Collections.ArrayList possibleFormats = hints == null?null:(System.Collections.ArrayList) hints[DecodeHintType.POSSIBLE_FORMATS];
bool useCode39CheckDigit = hints != null && hints[DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT] != null;
readers = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
if (possibleFormats != null)
{
if (possibleFormats.Contains(BarcodeFormat.EAN_13) || possibleFormats.Contains(BarcodeFormat.UPC_A) || possibleFormats.Contains(BarcodeFormat.EAN_8) || possibleFormats.Contains(BarcodeFormat.UPC_E))
{
readers.Add(new MultiFormatUPCEANReader(hints));
}
if (possibleFormats.Contains(BarcodeFormat.CODE_39))
{
readers.Add(new Code39Reader(useCode39CheckDigit));
}
if (possibleFormats.Contains(BarcodeFormat.CODE_128))
{
readers.Add(new Code128Reader());
}
if (possibleFormats.Contains(BarcodeFormat.ITF))
{
readers.Add(new ITFReader());
}
}
if ((readers.Count == 0))
{
readers.Add(new MultiFormatUPCEANReader(hints));
readers.Add(new Code39Reader());
readers.Add(new Code128Reader());
readers.Add(new ITFReader());
}
}
示例5: loadComment
public void loadComment(int idNews)
{
DataTable dt = daoNews.GetListComment(idNews);
PagedDataSource pgitems = new PagedDataSource();
System.Data.DataView dv = new System.Data.DataView(dt);
pgitems.DataSource = dv;
pgitems.AllowPaging = true;
pgitems.PageSize = 20;
if (PageNumber >= pgitems.PageCount) PageNumber = 0;
pgitems.CurrentPageIndex = PageNumber;
if (pgitems.PageCount > 1)
{
rptPagesComment.Visible = true;
System.Collections.ArrayList pages = new System.Collections.ArrayList();
for (int i = 0; i < pgitems.PageCount; i++)
pages.Add((i + 1).ToString());
rptPagesComment.DataSource = pages;
rptPagesComment.DataBind();
}
else
rptPagesComment.Visible = false;
rptComment.DataSource = pgitems;
rptComment.DataBind();
lblNumberComment.Text = "("+ dt.Rows.Count +")";
}
示例6: JrpcgenProgramInfo
/// <summary>
/// Construct a new <code>JrpcgenProgramInfo</code> object containing the
/// programs's identifier and number, as well as the versions defined
/// for this particular ONC/RPC program.
/// </summary>
/// <remarks>
/// Construct a new <code>JrpcgenProgramInfo</code> object containing the
/// programs's identifier and number, as well as the versions defined
/// for this particular ONC/RPC program.
/// </remarks>
/// <param name="programId">Identifier defined for this ONC/RPC program.</param>
/// <param name="programNumber">Program number assigned to this ONC/RPC program.</param>
/// <param name="versions">Vector of versions defined for this ONC/RPC program.</param>
public JrpcgenProgramInfo(string programId, string programNumber, System.Collections.ArrayList
versions)
{
this.programId = programId;
this.programNumber = programNumber;
this.versions = versions;
}
示例7: MultiFormatOneDReader
public MultiFormatOneDReader(System.Collections.Hashtable hints)
{
System.Collections.ArrayList possibleFormats = hints == null ? null : (System.Collections.ArrayList) hints[DecodeHintType.POSSIBLE_FORMATS];
readers = new System.Collections.ArrayList();
if (possibleFormats != null) {
if (possibleFormats.Contains(BarcodeFormat.EAN_13) ||
possibleFormats.Contains(BarcodeFormat.UPC_A) ||
possibleFormats.Contains(BarcodeFormat.EAN_8) ||
possibleFormats.Contains(BarcodeFormat.UPC_E))
{
readers.Add(new MultiFormatUPCEANReader(hints));
}
if (possibleFormats.Contains(BarcodeFormat.CODE_39)) {
readers.Add(new Code39Reader());
}
if (possibleFormats.Contains(BarcodeFormat.CODE_128))
{
readers.Add(new Code128Reader());
}
if (possibleFormats.Contains(BarcodeFormat.ITF))
{
readers.Add(new ITFReader());
}
}
if (readers.Count==0) {
readers.Contains(new MultiFormatUPCEANReader(hints));
readers.Contains(new Code39Reader());
readers.Contains(new Code128Reader());
// TODO: Add ITFReader once it is validated as production ready, and tested for performance.
//readers.addElement(new ITFReader());
}
}
示例8: 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)
{
}
}
}
}
示例9: XYPlotStyleCollectionController
public XYPlotStyleCollectionController(G2DPlotStyleCollection doc)
{
_doc = doc;
_tempdoc = new System.Collections.ArrayList();
for(int i=0;i<_doc.Count;i++)
_tempdoc.Add(_doc[i]);
}
示例10: GetCacheEntries
public virtual CacheEntry[] GetCacheEntries()
{
System.Collections.IList result = new System.Collections.ArrayList(17);
System.Collections.IEnumerator outerKeys = caches.Keys.GetEnumerator();
while (outerKeys.MoveNext())
{
System.Type cacheType = (System.Type) outerKeys.Current;
Cache cache = (Cache) caches[cacheType];
System.Collections.IEnumerator innerKeys = cache.readerCache.Keys.GetEnumerator();
while (innerKeys.MoveNext())
{
// we've now materialized a hard ref
System.Object readerKey = innerKeys.Current;
// innerKeys was backed by WeakHashMap, sanity check
// that it wasn't GCed before we made hard ref
if (null != readerKey && cache.readerCache.Contains(readerKey))
{
System.Collections.IDictionary innerCache = ((System.Collections.IDictionary) cache.readerCache[readerKey]);
System.Collections.IEnumerator entrySetIterator = new System.Collections.Hashtable(innerCache).GetEnumerator();
while (entrySetIterator.MoveNext())
{
System.Collections.DictionaryEntry mapEntry = (System.Collections.DictionaryEntry) entrySetIterator.Current;
Entry entry = (Entry) mapEntry.Key;
result.Add(new CacheEntryImpl(readerKey, entry.field, cacheType, entry.type, entry.custom, entry.locale, mapEntry.Value));
}
}
}
}
return (CacheEntry[]) new System.Collections.ArrayList(result).ToArray(typeof(CacheEntry));
}
示例11: CharacterSafeString
/// <summary>
/// Makes string safe for xml parsing, replacing control chars with '?'
/// </summary>
/// <param name="encodedString">string to make safe</param>
/// <returns>xml safe string</returns>
private static string CharacterSafeString(string encodedString)
{
/*The default code page for the system will be used.
Since all code pages use the same lower 128 bytes, this should be sufficient
for finding uprintable control characters that make the xslt processor error.
We use characters encoded by the default code page to avoid mistaking bytes as
individual characters on non-latin code pages.*/
char[] encodedChars = System.Text.Encoding.Default.GetChars(System.Text.Encoding.Default.GetBytes(encodedString));
System.Collections.ArrayList pos = new System.Collections.ArrayList();
for (int x = 0; x < encodedChars.Length; x++)
{
char currentChar = encodedChars[x];
//unprintable characters are below 0x20 in Unicode tables
//some control characters are acceptable. (carriage return 0x0D, line feed 0x0A, horizontal tab 0x09)
if (currentChar < 32 && (currentChar != 9 && currentChar != 10 && currentChar != 13))
{
//save the array index for later replacement.
pos.Add(x);
}
}
foreach (int index in pos)
{
encodedChars[index] = '?';//replace unprintable control characters with ?(3F)
}
return System.Text.Encoding.Default.GetString(System.Text.Encoding.Default.GetBytes(encodedChars));
}
示例12: JrpcgenVersionInfo
/// <summary>
/// Constructs a new <code>JrpcgenVersionInfo</code> object containing
/// information about a programs' version and a set of procedures
/// defined by this program version.
/// </summary>
/// <remarks>
/// Constructs a new <code>JrpcgenVersionInfo</code> object containing
/// information about a programs' version and a set of procedures
/// defined by this program version.
/// </remarks>
/// <param name="versionId">
/// Identifier defined for this version of a
/// particular ONC/RPC program.
/// </param>
/// <param name="versionNumber">Version number.</param>
/// <param name="procedures">Vector of procedures defined for this ONC/RPC program.</param>
public JrpcgenVersionInfo(string versionId, string versionNumber, System.Collections.ArrayList
procedures)
{
this.versionId = versionId;
this.versionNumber = versionNumber;
this.procedures = procedures;
}
示例13: Tokenizer
public Tokenizer(string source, string delimiters)
{
this.elements = new System.Collections.ArrayList();
this.delimiters = delimiters;
this.source = source;
this.ReTokenize();
}
示例14: ListInit
public void ListInit()
{
var l = new System.Collections.ArrayList()
{
1, 2, 3, 4
};
}
示例15: GetFiles
/// <summary>
/// Anche nelle sottodirectory
/// </summary>
/// <param name="path"></param>
/// <param name="pattern"></param>
/// <returns></returns>
public static System.Collections.ArrayList GetFiles(string path, string pattern)
{
System.Collections.ArrayList list = new System.Collections.ArrayList();
try
{
list.AddRange(System.IO.Directory.GetFiles(path, pattern));
}
catch { }
string[] dirs = null;
try
{
dirs = System.IO.Directory.GetDirectories(path);
}
catch { }
if (dirs != null)
{
foreach (string dir in dirs)
{
list.AddRange(GetFiles(dir, pattern));
}
}
return list;
}