In my project, I want to read some variables. This data is read from the form. However, I want to use them as a variable in my whole project. What is the correct way to use these variables through the whole project?
This is the part where the variables are read.
public void ReadSetupData() {
Constants setup = new Constants();
setup.cassette0 = tbCassette0.Text;
setup.cassette1 = tbCassette1.Text;
setup.cassette2 = tbCassette2.Text;
setup.cassette3 = tbCassette3.Text;
setup.cassette4 = tbCassette4.Text;
setup.flowController = tbFlowController.Text;
setup.valve = tbValve.Text;
setup.flowDeviation = Convert.ToDouble(tbMaxFlowDev);
setup.flowSet = Convert.ToDouble(tbFlowInput);
setup.flushTime = Convert.ToDouble(tbFlushTime);
setup.flushTimeCalibration = Convert.ToDouble(tbFlushTimeCalibration);
setup.intervalAveragePoints = Convert.ToDouble(tbIntervalAverage);
setup.movingAverageSize = Convert.ToDouble(tbMovingAverageSize);
setup.secsPerConcentration = Convert.ToDouble(tbSecsPerConc);
}
This is a class I made with all the variables. This class is not within the same class as the form.
public class Constants{
public string cassette0;
public string cassette1;
public string cassette2;
public string cassette3;
public string cassette4;
public string flowController;
public string valve;
public double flowDeviation;
public double secsPerConcentration;
public double intervalAveragePoints;
public double movingAverageSize;
public double flowSet;
public double flushTime;
public double flushTimeCalibration;
}