If you can't fix it, rewrite it. This code is crap - sorry.
The naming is weird: Cust
Dict is infact a
List, you have a
Result variable that is never used, naming a variable
temp is almost always an indication that you don't know what it is (if you fail to give decent names, you are lost).
First advise: for nested containers: don't do it unless it's a very obvious case of a table - even there, I'd prefer proper custom classes instead of direct use of a container.
E.g. a table is best managed by rows of cells or columns of cells (and not list of list of cells):
public class Table
{
#region nested classes
public class Cell
{
public string Value { get; set; }
}
public class Row
{
private Cell[] _columns;
public Row(int cols) { _columns = new Cell[cols]; }
public Cell Column(int col) { return _columns[col]; }
public Cell this[in col] { get { return Column(col); } }
}
#endregion
#region table
private List<Row> _rows;
public int NumOfColumns { get; private set; }
public int NumOfRows { get { return _rows.Count; } }
public Table(int cols) { NumOfColumns = cols; _rows = new List<Row>(); }
public void AddRow() { _rows.add(new Row(NumOfColumns)); }
public Row RowAt(int row) { return _rows[row]; }
public Row this[int row] { get { return RowAt(row); } }
public Cell this[int row, int col] { get { return this[row][col]; } }
#endregion
}
etc.
With this warmup, second advise: Use composition instead of referring to common data via same index.
I.e. in your example you seem to refer to the same customer by same index over various collections. This is very error prone. Create a class that holds that information.
E.g.
public class Customer
{
public string Name { get; private set; }
public Customer(string name) { Name = name; }
}
...
public class CustomerScores
{
public Customer { get; private set; }
public List<double> Scores { get; private set; }
public CustomerScores(Customer customer)
{ Customer = customer; Scores = new List<double>(); }
public void AddScore(double score) { Scores.Add(score); }
}
Third advise: create classes even for the tinyest piece of information (well, there is some limit, but you will get it for sure where to stop).
You seem to have some customer, some score and some containers that organize them in a certain manner (which is not clear to all of us according to the comments).
I make now an arbitrary choice that might not cover your example, but this is for illustration only.
public class Customer { ... }
public class CustomerScores { ... }
...
var customers = new List<Customer>()
{
new Customer("..."),
new Customer("..."),
...
};
var scoresPerCustomer = customers.Select(c=>new CustomerScores(c)).ToList();
...
...
...
...
Now it's up to you to give sense to
ConcateName(...)
and
CustDict
etc.
Cheers
Andi