本文整理汇总了C#中System.Collections.ArrayList.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.Clear方法的具体用法?C# ArrayList.Clear怎么用?C# ArrayList.Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ArrayList
的用法示例。
在下文中一共展示了ArrayList.Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveData
public bool SaveData(ArrayList ParameterList, DataTable dt)
{
bool bResult = false;
ArrayList Para = new ArrayList();
try
{
//ParameterList[0] D_CREATEDATE
//ParameterList[1] V_CREATEUID
VAM21_DBO DBO = new VAM21_DBO(ref USEDB);
Conn = USEDB.CreateConnection();
Conn.Open();
DBT = Conn.BeginTransaction();
//先刪除已存在DB內的資料
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows[i]["CREATEDATE"].ToString().Trim() != "")
{
Para.Clear();
Para.Add(dt.Rows[i]["ID"].ToString().Trim());
DBO.DeleteData(Para, DBT);
}
}
//全部重新INSERT
for (int i = 0; i < dt.Rows.Count; i++)
{
if ((dt.Rows[i]["ENABLE"].ToString().Trim() == "1") && (dt.Rows[i]["VENDOR"].ToString().Trim() != ""))
{
Para.Clear();
Para.Add(dt.Rows[i]["VENDOR"].ToString().Trim());
Para.Add(ParameterList[0]);
Para.Add(ParameterList[1]);
DBO.InsertData(Para, DBT);
}
}
DBT.Commit();
bResult = true;
}
catch (Exception ex)
{
if (DBT != null)
DBT.Rollback();
throw ex;
}
finally
{
//獨立呼叫Transcation,關閉連線
if (Conn.State == ConnectionState.Connecting)
Conn.Close();
}
return bResult;
}
示例2: sendEmail
public void sendEmail(string recipID, string msgBody)
{
ArrayList msgList = new ArrayList();
msgList.Clear();
msgList.Add(recipID);
foreach (string item in msgList)
{
try
{
MailMessage message = new MailMessage();
message.To.Add(item);
message.Subject = "Printable Integration Notication";
message.From = new MailAddress("[email protected]");
message.Body = msgBody;
message.ReplyTo = new MailAddress("[email protected]");
message.IsBodyHtml = true;
System.Net.Mail.SmtpClient smtp = Globals.get_smtpClient;
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("Sending email to " + message.To.ToString());
smtp.Send(message);
Console.WriteLine(" - Success");
Console.ResetColor();
message.Dispose();
}
catch (Exception e)
{
Console.WriteLine("SendEmail Error - RecipID:" + recipID + " - Receiver:" + item + " - Msg:" + msgBody);
Console.WriteLine(e.ToString());
Console.Beep();
//errorLog("Email-1", e.ToString(), "SendEmail Error - RecipID:" + recipID + " - Receiver:" + item + " - Msg:" + msgBody);
}
}
}
示例3: isPHPReady
public bool isPHPReady()
{
if (!File.Exists(var.strPHPTemplateConfigFilePath))
{
MessageBox.Show("The PHP template file, " + var.strPHPTemplateConfigFilePath + " cannot be found");
return false;
}
/*if (!File.Exists(var.strPHPTSConfigFilePath))
{
MessageBox.Show("The PHP configuration file, " + var.strPHPTSConfigFilePath + " cannot be found");
return false;
}
if (!File.Exists(var.strPHPNTSConfigFilePath))
{
MessageBox.Show("The PHP configuration file, " + var.strPHPNTSConfigFilePath + " cannot be found");
return false;
}*/
// Thread-safe PHP config
ArrayList alReplace = new ArrayList();
alReplace.Add(new string[]{";%INCLUDE_PATH%", "include_path=\".;"+var.strPHPTSFolderPath+"\\pear\""});
alReplace.Add(new string[]{"%EXTDIR%", Path.Combine(var.strPHPTSFolderPath, "ext")});
File.WriteAllText(var.strPHPTSConfigFilePath, var.replaceText(File.ReadAllText(var.strPHPTemplateConfigFilePath),alReplace));
// Non thread-safe PHP config
alReplace.Clear();
alReplace.Add(new string[]{";%INCLUDE_PATH%", "include_path=\".;"+var.strPHPNTSFolderPath+"\\pear\""});
alReplace.Add(new string[]{"%EXTDIR%", Path.Combine(var.strPHPNTSFolderPath, "ext")});
File.WriteAllText(var.strPHPNTSConfigFilePath, var.replaceText(File.ReadAllText(var.strPHPTemplateConfigFilePath),alReplace));
Environment.SetEnvironmentVariable("PHP_FCGI_MAX_REQUESTS",var.getString("PHP","numPHPRequests"));
return true;
}
示例4: BuildNumber
public override string BuildNumber(int Num)
{
Random random = new Random();
StringBuilder builder = new StringBuilder();
ArrayList al = new ArrayList();
for (int i = 0; i < Num; i++)
{
al.Clear();
for (int j = 0; j < 5; j++)
{
int ball = 0;
while ((ball == 0) || base.isExistBall(al, ball))
{
ball = random.Next(1, 0x17);
}
al.Add(ball.ToString().PadLeft(2, '0'));
}
LotteryBase.CompareToAscii comparer = new LotteryBase.CompareToAscii();
al.Sort(comparer);
string str = "";
for (int k = 0; k < al.Count; k++)
{
str = str + al[k].ToString() + " ";
}
builder.Append(str.Trim() + "\n");
}
string str2 = builder.ToString();
return str2.Substring(0, str2.Length - 1);
}
示例5: Query
public Query(Query another)
{
formula = new ArrayList();
Oid refOid = null;
try
{
if (another.Oid != null)
{
refOid = (Oid)another.Oid.Clone();
}
if (another.Formula != null)
{
QueryFormula[] items = (QueryFormula[])another.Formula.Clone();
formula.Clear();
foreach (QueryFormula item in items)
{
formula.Add(new QueryFormula(item));
}
}
}
catch (Exception e)
{
e.ToString();
}
oid = refOid;
}
示例6: CompareDocuments
public static ArrayList CompareDocuments(string document1, string document2)
{
Common.SetLicense();
ArrayList result = new ArrayList();
try
{
// Create a temporary folder
string comparisonDocument = GetCompareDocumentName(document1, document2);
// Call the util class for comparison
DocumentComparisonUtil docCompUtil = new DocumentComparisonUtil();
int added = 0, deleted = 0;
docCompUtil.Compare(document1, document2, comparisonDocument, ref added, ref deleted);
result.Add(Common.Success); // 0. Result
result.Add((comparisonDocument)); // 1. Path of the comparison document
result.Add(added); // 2. Number of additions
result.Add(deleted); // 3. Number of deletions
}
catch (Exception ex)
{
result.Clear();
result.Add(Common.Error + ": " + ex.Message); // 0. Result
}
return result;
}
示例7: ReadSettings
public static void ReadSettings( out bool enabled , out bool toast , ArrayList processActions )
{
PriorityManagerSettings p;
try
{
XmlSerializer deSerialiser = new XmlSerializer( typeof(PriorityManagerSettings) );
IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream( SettingsFileName , FileMode.Open , FileAccess.Read , FileShare.None );
System.IO.StreamReader reader = new System.IO.StreamReader( fileStream );
p = (PriorityManagerSettings)deSerialiser.Deserialize( reader );
enabled = p.Enabled ;
toast = p.ToastEnabled;
lock ( processActions.SyncRoot )
{
processActions.Clear();
processActions.AddRange( p.ProcessActions );
}
reader.Close();
}
catch
{
// hard coded defaults...
toast = true;
enabled = true;
processActions = new ArrayList();
}
}
示例8: CastFunc
public void CastFunc()
{
IList args = new ArrayList();
CastFunction cf = new CastFunction();
try
{
SqlString t = cf.Render(args, factoryImpl);
Assert.Fail("No exception if no argument");
}
catch (QueryException)
{
//correct
}
args.Add("'123'");
args.Add("long");
string expected =
string.Format("cast({0} as {1})", args[0], factoryImpl.Dialect.GetCastTypeName(SqlTypeFactory.Int64));
Assert.AreEqual(expected, cf.Render(args, factoryImpl).ToString());
args.Clear();
args.Add("'123'");
args.Add("NO_TYPE");
try
{
SqlString t = cf.Render(args, factoryImpl);
Assert.Fail("Ivalid type accepted");
}
catch (QueryException)
{
//correct
}
}
示例9: btnInhoadon_Click
private void btnInhoadon_Click(object sender, EventArgs e)
{
ArrayList listdv = new ArrayList();
ArrayList listp = new ArrayList();
listdv.Clear();
listp.Clear();
if (flagtinhtien == true)
{
listdv = new ArrayList(inhddvBUS.inhoadondv(labMaHD.Text));
listp = new ArrayList(inhdpBUS.InHoaDonPhong(labMaHD.Text));
qlks3lopDataSet.InhoadonDichVuDataTable dtdv = new qlks3lopDataSet.InhoadonDichVuDataTable();
qlks3lopDataSet.InhoadonPhongDataTable dtp = new qlks3lopDataSet.InhoadonPhongDataTable();
foreach (InHoaDonDichVuDTO hddv in listdv)
{
dtdv.Rows.Add(hddv.Maphieuthue, hddv.Tendichvu, hddv.Gia, hddv.Donvitinh, hddv.Soluong, hddv.MaPhong, hddv.Mahoadon, hddv.Ngay);
}
foreach (InHoaDonPhongDTO hdp in listp)
{
dtp.Rows.Add(hdp.Mahoadon, hdp.Tenkhachhang, hdp.Songayo, hdp.CMND, hdp.Diachi, hdp.Coquan, hdp.Sodienthoai, hdp.Email, hdp.Ngayden, hdp.Ngaydi, hdp.Sotiendatcoc, hdp.Gia, hdp.Maphong, hdp.Tennhanvien, hdp.Tongtien);
}
InHoaDon frmInHoaDon = new InHoaDon();
frmInHoaDon.dtdv = dtdv;
frmInHoaDon.dtp = dtp;
frmInHoaDon.ShowDialog();
//show_MaPT();
}
else MessageBox.Show("Thanh toán trước khi in hóa đơn");
}
示例10: GetGameObjectBlendshapes
/**
* Adds all possible blendshape targets of the game object
* curGameObject and its sub-objects (recursively) to the
* list of target blendshapes.
*/
public static void GetGameObjectBlendshapes(GameObject curGameObject, ArrayList blendshape_infos) {
if (blendshape_infos != null) blendshape_infos.Clear();
// Iterate over game object itself and over children and add blendshapes
Transform [] children = curGameObject.GetComponentsInChildren<Transform>();
foreach (Transform child in children)
{
string transformPath = CalculateTransformPath(child, curGameObject.transform);
SkinnedMeshRenderer meshRenderer = (SkinnedMeshRenderer)child.GetComponent(typeof(SkinnedMeshRenderer));
if (meshRenderer != null)
{
if (meshRenderer.sharedMesh != null)
{
//Debug.Log("Number of blend shapes: " + meshRenderer.sharedMesh.blendShapeCount);
for (int blend_shape_nr = 0; blend_shape_nr < meshRenderer.sharedMesh.blendShapeCount; blend_shape_nr++) {
string blend_shape_name = meshRenderer.sharedMesh.GetBlendShapeName(blend_shape_nr);
//Debug.Log("Path: '" + transformPath + "', blend shape: '" + blend_shape_name + "'");
if (blendshape_infos != null) {
BlendshapeInfo blendshape_info = new BlendshapeInfo();
blendshape_info.m_path = transformPath;
blendshape_info.m_name = blend_shape_name;
blendshape_info.m_index = blend_shape_nr;
blendshape_info.m_mesh_renderer = meshRenderer;
blendshape_infos.Add (blendshape_info);
}
}
}
}
}
}
示例11: ImportComComponent
internal bool ImportComComponent(string path, OutputMessageCollection outputMessages, string outputDisplayName)
{
ComImporter importer = new ComImporter(path, outputMessages, outputDisplayName);
if (importer.Success)
{
ArrayList list = new ArrayList();
if (this.typeLibs != null)
{
list.AddRange(this.typeLibs);
}
if (importer.TypeLib != null)
{
list.Add(importer.TypeLib);
}
this.typeLibs = (TypeLib[]) list.ToArray(typeof(TypeLib));
list.Clear();
if (this.comClasses != null)
{
list.AddRange(this.comClasses);
}
if (importer.ComClasses != null)
{
list.AddRange(importer.ComClasses);
}
this.comClasses = (ComClass[]) list.ToArray(typeof(ComClass));
}
return importer.Success;
}
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//
//Setup Criteria
//
RestrictValueCount = RestrictValueOptions.OnlyOne_Period;
//
// Setup cmbDistrict
//
cmbDistrict.Attributes.Add("CriteriaName", CriteriaName);
cmbDistrict.OnClientSelectedIndexChanged = CriteriaName + "Controller.OnComboChanged";
cmbDistrict.OnClientLoad = CriteriaName + "Controller.PopulateControls";
ValueDisplayTemplateName = "DistrictCriteriaValueDisplayTemplate";
//
// Create Json array strings for populating our dropdownlist controls, and register them as javascript;
//
var serializer = new JavaScriptSerializer();
var arry = new ArrayList();
// data for cmbDistrict
arry.Clear();
// todo: mpf - populate district data. //arry = Semester.BuildJsonArray();
ScriptManager.RegisterStartupScript(this, typeof(string), CriteriaName + "DependencyData", "var " + CriteriaName + "DependencyData = " + serializer.Serialize(arry) + ";", true);
}
ConfigureCriteriaHeader(CriteriaHeader, RadToolTip1);
}
示例13: Equivalent
public Equivalent(Equivalent another)
{
torso = new ArrayList();
Oid refOid = null;
torso = new ArrayList();
try
{
if (another.Oid != null)
{
refOid = (Oid)another.Oid.Clone();
}
if (another.Torso != null)
{
Torso[] items = (Torso[])another.Torso.Clone();
torso.Clear();
foreach (Torso item in items)
{
torso.Add(new Torso(item));
}
}
}
catch (Exception e)
{
e.ToString();
}
oid = refOid;
}
示例14: train
public train(formDelegate sender, ArrayList from)
{
trainDelegate = sender;
toolTip = Convert.ToBoolean(from[0]);
from.Clear();
InitializeComponent();
}
示例15: AddClassFrm
private void 添加分类ToolStripMenuItem_Click(object sender, EventArgs e)
{
AddClassFrm addclass = new AddClassFrm();
if (addclass.ShowDialog() == DialogResult.OK)
{
string classStr = addclass.textBox1.Text.ToUpper().ToString();
ArrayList selectedlist = new ArrayList();
foreach (DataGridViewRow dr in this.dataGridView1.Rows)
{
if (dr.Selected == true)
{
selectedlist.Add(dr.Index);
}
}
for (int i = 0; i < selectedlist.Count; i++)
{
int index = int.Parse(selectedlist[i].ToString());
string projectidStr = this.dataGridView1.Rows[index].Cells["项目号"].Value.ToString();
string drawingStr = this.dataGridView1.Rows[index].Cells["图纸号"].Value.ToString();
string spoolStr = this.dataGridView1.Rows[index].Cells["小票号"].Value.ToString();
WorkShopStatusFlow.AddTrayORClass("SP_ADDCLASSIFICATION", projectidStr, drawingStr, spoolStr, classStr);
this.dataGridView1.Rows[index].Cells["分类"].Value = classStr;
}
selectedlist.Clear();
MessageBox.Show("--------完成--------");
}
}