ArrayList.add(tmp)循环之后怎么清空临时变量tmp,而不清空结果对象。复制代码list结果,怎么会是都为最后一项{(KL43(2) 500x900,1) (KL43(2) 500x900,1) (KL43(2) 500x900,1)}
- //获取双重表值为ArrayList
- public static ArrayList GetLispSymList2(ResultBuffer rb)
- {
- if (rb != null)
- {
- ArrayList list = new ArrayList();
- ArrayList sub = new ArrayList();
- foreach (TypedValue v in (System.Collections.IEnumerable)rb)
- {
- //LispBegin 5016 ListEnd 5017
- if (v.TypeCode == 5016)
- {
- sub.Clear();
- }
- else if (v.TypeCode == 5017)
- {
- list.Add(sub);
- }
- else
- {
- sub.Add(v.Value);
- }
- }
- return list;
- }
- else
- {
- return null;
- }
- }
|