how to create array [,] with some list

I want to create array [,] with list class here (ListValue.cs):

class ListValue
{
    public string val_DT { get; set; }
    public string val_TR { get; set; }
    public string val_PL { get; set; }
    public string val_LP { get; set; }
    public string Result { get; set; }

public ListValue(string n_dt, string n_tr, string n_pl, string n_lp, n_result)
    {
        
        this.val_DT = n_dt;
        this.val_TR = n_tr;
        this.val_PL = n_pl;
        this.val_LP = n_lp;

    }
}

I tried this but didn’t works (Script.cs) :

 _Array = new double[2, ListValue.Count]; 
double[] _A, _B, _C, _D;
double a, b, c, d;
for (int i = 0; i < ListValue.Count; i++)
            {
                _Array[0, i] = (_A <em>* a) + (_B <em>* b) + (_C _* c +_</em></em>

(_D * d;
_Array[1, i] = i;

}
bool flag = true;
double tmp;

for (int i = 1; (i < ListValue.Count - 1) && flag; i++)
{
flag = false;

for (int j = 0; j < ListValue.Count - 1; j++)
{
if (_Array[0, j + 1] > _Array[0, j])
{
tmp = _Array[0, j];
_Array[0, j] = _Array[0, j + 1];
_Array[0, j + 1] = tmp;
tmp = _Array[1, j];
_Array[1, j] = _Array[1, j + 1];
_Array[1, j + 1] = tmp;
flag = true;

Debug.Log(_Array[1, i]);

}

}

}
The debug.log no show result. :frowning:

Sorry but your code just makes no sense and doesn’t compile. It seems you try to implement some kind of bubble sort algorithm which sorts the arrays based on the first dimension. However you don’t use your “ListValue” class anywhere in your code besides “ListValue.Count”, However your ListValue class doesn’t have a static Count variable. All your variables have abstract names which do not help to understand the purpose of the code. This is generally called “bad code”.

Imagine you have a one or two years break in development. When you come back to the project i don’t think you immediately know what val_DT, val_TR, val_PL, val_LP stands for or what _A, _B, _C, _D contains.

Currently this line:

_Array[0, i] = (_A <em>* a) + (_B <em>* b) + (_C <em>* c + (_D _* d;_</em></em></em>

doesn’t compile at all since you are missing closing brackets. Those brackets are redundant anyways.
Finally you said:
> I tried this but didn’t works
This is not a proper description of a problem. What doesn’t work? do you have any compile time / runtime errors?