I am trying to save a floating point values (from a Float[] array) to a variable property (of type float), but I am not able to save it correctly. Everytime I want to save a new value, the variable property never accepts the new value and keep retaining the intialized value only. Here I am trying to save value,
CommandLineVariables.PiSenseResistor = tempFloatArray[0];
Where,
- CommandLineVariables is the class name
- PiSenseResistor is the variable property
- tempFloatArray is the float array from which I want to save value
I tried using single stepping and watching the variable property value, but always after the execution of the above mentioned instruction, it shows the initialized value only.
The same thing I am doing with other variable properties as well and they are working correctly. I am wondering what I am doing wrong with this saving of floating point number into variable property.
Edited
Adding some extract of the code:
//variable initialization
private static float piOffsetPressure = 1.01295f;
//Property definition for the variable
public float PiOffsetPressure
{
get
{
return piOffsetPressure;
}
set
{
piOffsetPressure = value;
}
}
//Copy the parameter value into its corresponding property
if (!Convert.ToBoolean(ReturnCode))
{
CommandLineVariables.PiOffsetPressure = tempFloatArray[0];
CommandLineVariables.PdOffsetPressure = tempFloatArray[1];
}
You are setting
PiOffsetPressure, but the property you posted isPiSenseResistor. Why would setting one affect the other?