我從Web服務調用發送如下的ArrayList:對字符串數組進行排序
private ArrayList testList = new ArrayList();
將存儲像值:
"xyz (pound) (4545)"
"abc (in) (346)"
"def (off) (42424)"
我用兩個這一點,因爲原因:
1:我要取在ASP.NET 1.1框架此值。 2:我使用testList.Sort();我使用testList.Sort();我使用testList.Sort();}我使用testList.Sort();發送之前。
但現在我想給這些值:
"xyz" "pound" "4545"
"abc" "in" "346"
"def" "off" "42424"
所以我發現如下的方式:
string[][] data = { new string[]{"xyz", "pound", "4545"},
new string[]{"abc", "in", "346"},
new string[]{"def", "off", "42424"}};
的問題是:我怎樣纔能有效地對它進行排序?或者有更好的方法來解決這個問題嗎?
排序將基於第一個元素來完成:
abc
def
xyz
是的,你的假設是正確的。發送網站是4.0 – James
只是想知道這個解決方案與我的不同嗎?另外註釋它是錯誤的,因爲排序是由數組項目,而不是字段 –
關閉問題 - 我在循環中添加這些字符串數組... ...像這樣//將每個信息添加到字符串數組。 data = new string [3]; data [0] =「xyz」; data [1] =「8787」; data [2] =「爸爸」; //將每一行添加到數組列表中。 arrList.Add(data); //將數組列表添加到屬性對象。 vinDescription.ShowOptionalEquipment =(string [] [])arrList.ToArray(typeof(string []));'...這是正確的還是更好的方法? – James