T
tshad
I have a class:
*******************************************
public class DecimalType
{
private decimal first = 0; //original data
private decimal data = 0; //current data
public bool nullFirst = false; //original Data null
public bool nullData = false; //current data null
public DecimalType()
{
}
public DecimalType(decimal initial)
{
first = initial;
data = initial;
}
public bool IsNull()
{
return nullData;
}
public bool IsFirstNull()
{
return nullFirst;
}
public void SetNull()
{
nullData = true;
data = 0;
}
public void SetFirstNull()
{
nullFirst = true;
first = 0;
}
// Properties
public decimal First
{
get { return first; }
set { first = value; }
}
public decimal Data
{
get { return data; }
set { data = value; nullData = false; }
}
} // end Class
********************************************
In another program I call the SetNull() method, but it isn't setting my
flag. If I directly set it, it works fine:
public static void GetValueFromDbObject(object dbObjectValue, ref
DecimalType destination)
....
destination.SetNull();
destination.Data = 2000;
destination.nullData = true;
....
If I comment out the direct change (destination.nullData), nullData is still
false. But above it is setting it to true. If I leave the
destination.nullData = true line in, the flag gets set.
Why doesn't the SetNull() method work?
Thanks,
Tom
*******************************************
public class DecimalType
{
private decimal first = 0; //original data
private decimal data = 0; //current data
public bool nullFirst = false; //original Data null
public bool nullData = false; //current data null
public DecimalType()
{
}
public DecimalType(decimal initial)
{
first = initial;
data = initial;
}
public bool IsNull()
{
return nullData;
}
public bool IsFirstNull()
{
return nullFirst;
}
public void SetNull()
{
nullData = true;
data = 0;
}
public void SetFirstNull()
{
nullFirst = true;
first = 0;
}
// Properties
public decimal First
{
get { return first; }
set { first = value; }
}
public decimal Data
{
get { return data; }
set { data = value; nullData = false; }
}
} // end Class
********************************************
In another program I call the SetNull() method, but it isn't setting my
flag. If I directly set it, it works fine:
public static void GetValueFromDbObject(object dbObjectValue, ref
DecimalType destination)
....
destination.SetNull();
destination.Data = 2000;
destination.nullData = true;
....
If I comment out the direct change (destination.nullData), nullData is still
false. But above it is setting it to true. If I leave the
destination.nullData = true line in, the flag gets set.
Why doesn't the SetNull() method work?
Thanks,
Tom