for (int i = 1; i <= numberofmatricesrequired; i++)
            {
            string number = Convert.ToString(i);
            Matrix (matrixnumber+number) = new Matrix(matrixsize, matrixsize);
            }

Basically I have x amount of matrices I need to establish of y by y size. I was hoping to name the matrices: matrixnumber1 matrixnumber2..matrixnumbern

I cannot use an array as its matrices I have to form.

Is it possible to use a string to name a string (or a matrix in this case)?

Thank you in advance for any help on this!

It's probably possible with reflection, however, why dont you store your matrix in a Collection called matrixcollection than use and indexer to grab which "number" you want.

Something like the following would be quite interresting for your case:

Dictionary<string, CustomObj> map = new Dictionary<string, CustomObj>(); 
 
foreach (string name in stringArray) 
{ 
    map[name] = new CustomObj(name); 
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.