I am using Visual Studio 2013 and C#
I want to be able to compare the name of a string variable with a string I create.
The string variable is called print1 (for instance)
public string print1;
I then create a string to like so:
foreach (int number in orderOfNumber)
{
string printNumber = String.Format("print{0}", number-1);
}
I discard this if 'number' = 1 so I am not concerned with the number ever being 0
What I would like to do is print a string in a MessageBox with a few lines. One line will have the time taken between clicking two pictures on the screen. Basically formatted like this:
//Time taken:
1 and 2 -> 1.234 secs
What I have so far is this:
orderBuilder.Append(String.Format("{0} and {1}\t\t", orderOfNumber[number-1], orderOfPicturesNumber[number])).Append("" + printNumber + "\n");
No matter how I try I always end up with
1 and 2 print1
This is close to what I want as the value for print1 is actually 1.234
Is there a way to replace the 'string' print1 with the original variable print1?