This code: List<list> DscAtt = new List<list>(); will never compile. I assume "((a,b,c),(d,e),(f),(g,h,i,j),(k,l)...)" is an example of your raw data. And, I am going to assume you know how to use either String.Split or RegEx, or whatever, to parse that into a collection of strongly typed lists. If you need help with parsing the string representation of a nested list to a strongly typed nested list, or group of nested lists, ask.
Using this as an example of a generic List of Lists of strings:
List<List<string>> testNestedList = new List<List<string>>
{
new List<string>{"a", "b", "c", "d"},
new List<string>{"e", "f", "g", "h"},
new List<string>{"i", "j", "k"},
new List<string>{"l", "m"},
new List<string>{"1", "2", "3", "4", "5"}
};
Writing a method/function to return any particular indexed value in every sub-list is easy:
private List<string> SelectSubItems(int ndx, List<List<string>> theList)
{
List<string> matches = new List<string>();
foreach(var subList in theList)
{
if (ndx < subList.Count) matches.Add(subList[ndx]);
}
return matches;
}
Note this method will return a List<string>; you can test it like this:
var test = SelectSubItems(4, testNestedList);