本文整理汇总了C#中ArrayList类的典型用法代码示例。如果您正苦于以下问题:C# ArrayList类的具体用法?C# ArrayList怎么用?C# ArrayList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArrayList类属于命名空间,在下文中一共展示了ArrayList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getfiles
public void getfiles(string dir)
{
ddFilesMovie.Items.Clear();
ListItem li1 = new ListItem();
li1.Text = "-- select --";
li1.Value = "-1";
ddFilesMovie.Items.Add(li1);
ArrayList af = new ArrayList();
string[] Filesmovie = Directory.GetFiles(dir);
foreach (string file in Filesmovie)
{
string appdir = Server.MapPath("~/App_Uploads_Img/") + ddCatMovie.SelectedValue;
string filename = file.Substring(appdir.Length + 1);
if ((!filename.Contains("_svn")) && (!filename.Contains(".svn")))
{
if (filename.ToLower().Contains(".mov") || filename.ToLower().Contains(".flv") || filename.ToLower().Contains(".wmv") )
{
ListItem li = new ListItem();
li.Text = filename;
li.Value = filename;
ddFilesMovie.Items.Add(li);
}
}
}
UpdatePanel1Movie.Update();
}
示例2: Neighbours
public ArrayList Neighbours( Moveable peep)
{
Character peepChar = peep.gameObject.GetComponent<Character> ();
bool peepCanPathThroughEnemies = peep.canPathThroughEnemies;
ArrayList neighbourhood = new ArrayList ();
if (left != null && !peep.unpathables.Contains(left.GetComponent<HexTile>().Type)
&& ( peepCanPathThroughEnemies
|| !ArrayListsIntersect( left.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams)))
neighbourhood.Add (left);
if (right != null && !peep.unpathables.Contains(right.GetComponent<HexTile>().Type)
&& ( peepCanPathThroughEnemies
|| !ArrayListsIntersect( right.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams)))
neighbourhood.Add (right);
if (up_left != null && !peep.unpathables.Contains(up_left.GetComponent<HexTile>().Type)
&& ( peepCanPathThroughEnemies
|| !ArrayListsIntersect( up_left.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams)))
neighbourhood.Add (up_left);
if (up_right != null && !peep.unpathables.Contains(up_right.GetComponent<HexTile>().Type)
&& ( peepCanPathThroughEnemies
|| !ArrayListsIntersect( up_right.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams)))
neighbourhood.Add (up_right);
if (down_right != null && !peep.unpathables.Contains(down_right.GetComponent<HexTile>().Type)
&& ( peepCanPathThroughEnemies
|| !ArrayListsIntersect( down_right.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams)))
neighbourhood.Add (down_right);
if (down_left != null && !peep.unpathables.Contains(down_left.GetComponent<HexTile>().Type)
&& ( peepCanPathThroughEnemies
|| !ArrayListsIntersect( down_left.GetComponent<HexTile>().occupantTeams, peepChar.enemyTeams)))
neighbourhood.Add (down_left);
return neighbourhood;
}
示例3: Auth_GetAutoTokenCommand
//type = a:1/10, b:1/100, c:1/1000
public Auth_GetAutoTokenCommand( string playerId,string secret, CompleteDelegate completeDelegate, ErrorDelegate errorDelegate)
{
Hashtable batchHash = new Hashtable ();
batchHash.Add ("authKey", AuthUtils.generateRequestToken (playerId, secret));
ArrayList commands = new ArrayList();
Hashtable command = new Hashtable ();
command.Add ("action", "auth.getAuthToken");
command.Add ("time", TimeUtils.UnixTime);
command.Add ("args", new Hashtable () { { "playerId", playerId }, { "secret", secret }});
// command.Add ("expectedStatus","");
command.Add ("requestId", 123);
// command.Add ("token", "");
commands.Add(command);
batchHash.Add("commands",commands);
batch = MiniJSON.jsonEncode(batchHash);
////////
this.onComplete = delegate(Hashtable t){
//{"requestId":null,"messages":{},"result":"aWeha_JMFgzaF5zWMR3tnObOtLZNPR4rO70DNdfWPvc.eyJ1c2VySWQiOiIyMCIsImV4cGlyZXMiOiIxMzg1NzA5ODgyIn0","status":0}
Hashtable completeParam = new Hashtable();
completeParam.Add("result",t["result"]);
completeDelegate(completeParam);
};
/////////
this.onError = delegate(string err_code,string err_msg, Hashtable data){
errorDelegate(err_code,err_msg,data);
};
}
示例4: GetTestedMethods
public MemberInfo[] GetTestedMethods()
{
Type type = typeof(Convert);
ArrayList list = new ArrayList();
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Byte)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(SByte)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Int16)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Int32)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Int64)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(UInt16)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(UInt32)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(UInt64)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(String), typeof(IFormatProvider)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(String)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Boolean)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Char)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Object)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Object), typeof(IFormatProvider)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Single)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Double)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(DateTime)}));
list.Add(type.GetMethod("ToBoolean", new Type[]{typeof(Decimal)}));
MethodInfo[] methods = new MethodInfo[list.Count];
list.CopyTo(methods, 0);
return methods;
}
示例5: Start
// Use this for initialization
void Start () {
if (IntroScript == null) IntroScript = new ArrayList();
if (IntroScript != null && IntroScript.Count != 0) IntroScript.Clear();
if (IntroScript != null && IntroScript.Count == 0) AddScriptToList();
ContinueButton_Click();
}
示例6: GetCompletionList
public static string[] GetCompletionList(string prefixText, int count)
{
//連線字串
//string connStr = @"Data Source=.\SQLEXPRESS;AttachDbFilename="
//+ System.Web.HttpContext.Current.Server.MapPath("~/App_Data/NorthwindChinese.mdf") + ";Integrated Security=True;User Instance=True";
ArrayList array = new ArrayList();//儲存撈出來的字串集合
//using (SqlConnection conn = new SqlConnection(connStr))
using (SqlConnection conn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
{
DataSet ds = new DataSet();
string selectStr = @"SELECT Top (" + count + ") Account_numbers FROM Account_Order_M_View Where Account_numbers Like '" + prefixText + "%'";
SqlDataAdapter da = new SqlDataAdapter(selectStr, conn);
conn.Open();
da.Fill(ds);
foreach (DataRow dr in ds.Tables[0].Rows)
{
array.Add(dr["Account_numbers"].ToString());
}
}
return (string[])array.ToArray(typeof(string));
}
示例7: OscMessagesToPacket
/// <summary>
/// Puts an array of OscMessages into a packet (byte[]).
/// </summary>
/// <param name="messages">An ArrayList of OscMessages.</param>
/// <param name="packet">An array of bytes to be populated with the OscMessages.</param>
/// <param name="length">The size of the array of bytes.</param>
/// <returns>The length of the packet</returns>
public static int OscMessagesToPacket(ArrayList messages, byte[] packet, int length)
{
int index = 0;
if (messages.Count == 1)
index = OscMessageToPacket((OscMessage)messages[0], packet, 0, length);
else
{
// Write the first bundle bit
index = InsertString("#bundle", packet, index, length);
// Write a null timestamp (another 8bytes)
int c = 8;
while (( c-- )>0)
packet[index++]++;
// Now, put each message preceded by it's length
foreach (OscMessage oscM in messages)
{
int lengthIndex = index;
index += 4;
int packetStart = index;
index = OscMessageToPacket(oscM, packet, index, length);
int packetSize = index - packetStart;
packet[lengthIndex++] = (byte)((packetSize >> 24) & 0xFF);
packet[lengthIndex++] = (byte)((packetSize >> 16) & 0xFF);
packet[lengthIndex++] = (byte)((packetSize >> 8) & 0xFF);
packet[lengthIndex++] = (byte)((packetSize) & 0xFF);
}
}
return index;
}
示例8: StyleJeuSimple
/**
* Controle la balle avec des deplacements gauche,
* droite et profondeur
* return listFloat
*/
ArrayList StyleJeuSimple(){
Frame frame = controller.Frame();
Hand hand = frame.Hands.Rightmost;
handPosition = hand.PalmPosition;
ArrayList listFloat = new ArrayList();
float moveSimpleX = 0;
float moveSimpleZ = 0;
export.AddRow();
export["Time in ms"] = Time.timeSinceLevelLoad;
export["Pos hand in x"] = handPosition.x;
export["Pos hand in z"] = handPosition.z;
if(hand.IsValid){
if(moveSimpleX == (handPosition.x)/10 * Time.deltaTime * 3){
moveSimpleX = 0;
}else{
moveSimpleX = (handPosition.x)/10 * Time.deltaTime * 3;
}
if (moveSimpleZ == (-handPosition.z) / 10 * Time.deltaTime * 3){
moveSimpleZ = 0;
}else{
moveSimpleZ = (-handPosition.z) / 10 * Time.deltaTime * 3;
}
}
listFloat.Add(moveSimpleX);
listFloat.Add(moveSimpleZ);
return listFloat;
}
示例9: GetData
/*
============================================================================
Data handling functions
============================================================================
*/
public Hashtable GetData(Hashtable ht)
{
if(this.active)
{
ArrayList s = new ArrayList();
ht.Add("distance", this.distance.ToString());
ht.Add("layermask", this.layerMask.ToString());
if(this.ignoreUser) ht.Add("ignoreuser", "true");
ht = this.mouseTouch.GetData(ht);
ht.Add("rayorigin", this.rayOrigin.ToString());
VectorHelper.ToHashtable(ref ht, this.offset);
if(TargetRayOrigin.USER.Equals(this.rayOrigin))
{
s.Add(HashtableHelper.GetContentHashtable(TargetRaycast.CHILD, this.pathToChild));
if(!this.mouseTouch.Active())
{
VectorHelper.ToHashtable(ref ht, this.rayDirection, "dx", "dy", "dz");
}
}
s.Add(HashtableHelper.GetContentHashtable(TargetRaycast.TARGETCHILD, this.pathToTarget));
VectorHelper.ToHashtable(ref ht, this.targetOffset, "tx", "ty", "tz");
if(s.Count > 0) ht.Add(XMLHandler.NODES, s);
}
return ht;
}
示例10: refreshItemShow
public void refreshItemShow()
{
ArrayList lItemList = bagControl.getItemList();
//Debug.Log(lItemList);
itemIndexList = lItemList;
int lItemUIIndex = 0;
zzIndexTable lItemTypeTable = bagControl
.getItemSystem().getItemTypeTable();
foreach (int i in lItemList)
{
ItemTypeInfo lItemType = (ItemTypeInfo)lItemTypeTable.getData(i);
itemListUI[lItemUIIndex].setImage(lItemType.getImage());
itemListUI[lItemUIIndex].setVisible(true);
++lItemUIIndex;
}
itemNum = lItemUIIndex;
//Debug.Log(lItemUIIndex);
//更新选择的位置
if (showSelected && lItemUIIndex < selectedIndex)
setSelected(lItemUIIndex);
//将剩余的图标空间清空
for (; lItemUIIndex < numOfShowItem; ++lItemUIIndex)
itemListUI[lItemUIIndex].setVisible(false);
}
示例11: Start
// Use this for initialization
void Start()
{
Zoom.OnChangeZoom += OnChangeZoom;
mg = GameObject.Find ("Manager").GetComponent<Manager> ();
locationList = new ArrayList ();
locationListScreen = new ArrayList ();
using (StreamReader reader = new StreamReader(Application.dataPath + "\\"+RouteListPath)) {
while (!reader.EndOfStream) {
string line = reader.ReadLine ();
string[] parts = line.Split (",".ToCharArray ());
locationList.Add(new double[]{double.Parse(parts[0]),double.Parse(parts[1])});
}
reader.Close();
}
lineParameter = "&path=color:0xff0030";
for (int i=0; i< locationList.Count; i++) {
double[] d_pos = (double[])locationList [i];
lineParameter += "|" + d_pos [0].ToString () + "," + d_pos [1].ToString ();
double[] point = {(double)d_pos [1], (double)d_pos [0]};
Vector3 pos = mg.GIStoPos (point);
locationListScreen.Add (pos);
}
#if !(UNITY_IPHONE)
mg.sy_Map.addParameter = lineParameter;
#endif
}
示例12: removeBullet
public void removeBullet(ArrayList prams)
{
GameObject scene = objs[0] as GameObject;
GameObject caller = objs[1] as GameObject;
GameObject bltObj = prams[0] as GameObject;
GameObject targetObj = prams[1] as GameObject;
Destroy(bltObj);
if(targetObj == null)
{
return;
}
if(icePrb == null)
{
icePrb = Resources.Load("eft/StarLord/SkillEft_STARLORD15A_Ice") as GameObject;
}
GameObject ice = Instantiate(icePrb) as GameObject;
ice.transform.position = targetObj.transform.position + new Vector3(0, 80, targetObj.transform.position.z - (targetObj.transform.position.z + 100));
StarLord heroDoc = (prams[2] as GameObject).GetComponent<StarLord>();
Character c = targetObj.GetComponent<Character>();
SkillDef skillDef = SkillLib.instance.getSkillDefBySkillID("STARLORD15A");
Hashtable tempNumber = skillDef.activeEffectTable;
int tempAtkPer = (int)((Effect)tempNumber["atk_PHY"]).num;
c.realDamage(c.getSkillDamageValue(heroDoc.realAtk, tempAtkPer));
}
示例13: GetCustomListDt
public DataTable GetCustomListDt(int modelId)
{
DataTable dt = bllModelField.GetList(modelId);
DataRow dr = dt.NewRow();
dr["Alias"] = "搜索链接";
dr["Name"] = "$search$";
dt.Rows.Add(dr);
ArrayList erArrayList = new ArrayList();
for (int i = 0; i < dt.Rows.Count; i++)
{
string[] erArray = new string[3];
DataRow tdr = dt.Rows[i];
if (tdr["type"].ToString().ToLower() == "erlinkagetype")
{
erArray[0] = i.ToString();
erArray[1] = bllModelField.GetFieldContent(tdr["content"].ToString(), 1, 1);
erArray[2] = bllModelField.GetFieldContent(tdr["content"].ToString(), 2, 1);
erArrayList.Add(erArray);
}
}
for (int i = 0; i < erArrayList.Count; i++)
{
dr = dt.NewRow();
string[] tmp = (string[])erArrayList[i];
dr["Alias"] = tmp[1];
dr["Name"] = tmp[2];
int pos = int.Parse(tmp[0]);
dt.Rows.InsertAt(dr, pos + 1+ i);
}
ctmFildCount = dt.Rows.Count;
return dt;
}
示例14: Cast
public override IEnumerator Cast(ArrayList objs)
{
GameObject scene = objs[0] as GameObject;
GameObject caller = objs[1] as GameObject;
GameObject target = objs[2] as GameObject;
parms = objs;
Hero drax = caller.GetComponent<Hero>();
drax.castSkill("Skill15B_a");
yield return new WaitForSeconds(.34f);
MusicManager.playEffectMusic("SFX_Drax_Fear_Me_1a");
yield return new WaitForSeconds(.7f);
StartCoroutine(ShowStones(stones_a));
yield return new WaitForSeconds(.46f);
caller.transform.position = new Vector3(0, 0, StaticData.objLayer);
drax.castSkill("Skill15B_b");
if(!drax.isDead){
Debug.LogError("4343");
StartCoroutine(ShowStones(stones_b));
StartCoroutine(ShowGrownLight());
StartCoroutine(ShowBigHolo());
ReadData();
FearMe();
}
}
示例15: MenuTemplate
public MenuTemplate(string name)
{
menuName = name;
itemTemplates = new ArrayList ();
mainBackground = Resources.Load ("Textures/MainBackground") as Texture;
setStyles ();
}