[C#]大量宣告Array或ArrayList

摘要:[C#]大量宣告Array或ArrayList

 

using System.Collections;
using System.Collections.Generic;

..............
......................................
  
Dictionary<string, ArrayList> TryArryList = new Dictionary<string, ArrayList>();  

// 建立ArryList

TryArryList.Add("TAL1", new ArrayList());
TryArryList.Add("TAL2", new ArrayList());
TryArryList.Add("TAL3", new ArrayList());
TryArryList.Add("TAL4", new ArrayList());
TryArryList.Add("TAL5", new ArrayList());
TryArryList.Add("TAL6", new ArrayList());
TryArryList.Add("TAL7", new ArrayList());
.....
.....................

//get;set;

TryArryList["TAL1"][0] = ...;
TryArryList["TAL1"][1] = ...
TryArryList["TAL1"][2] = ...;
TryArryList["TAL1"][3] = ...;
.......................
.......................................

TryArryList["TAL2"][0] = ...;
TryArryList["TAL2"][1] = ...;
TryArryList["TAL2"][2] = ...;
.........................
. .................................
....................................................