当我序列化我的对象时,我的双精度值被打印为 -9.9999999999988987E-05 我该如何解决这个问题,这样我才能得到一个小数点后 4 位的数字?
public class DecisionBar
{
public DateTime bartime
{ get; set; }
public string frequency
{ get; set; }
public bool HH7
{get;set;}
public bool crossover
{get;set;}
public double mfe
{get;set;}
public double mae
{get;set;}
public double currentprofitability
{get;set;}
public double entryPointLong
{get;set;}
public double entryPointShort
{get;set;}
public double exitStopFull
{get;set;}
public double exitStopPartial
{get;set;}
[XmlAttribute]
public string EntryOrExit
{get;set;}
// public DecisionBar()
// {
// crossover =false;
// }
}
输出。
<DecisionBar>
<bartime>2012-07-24T08:59:00</bartime>
<frequency>1 MINUTES</frequency>
<HH7>false</HH7>
<crossover>false</crossover>
<mfe>0.00019999999999997797</mfe>
<mae>-9.9999999999988987E-05</mae>
<currentprofitability>0</currentprofitability>
<entryPointLong>0</entryPointLong>
<entryPointShort>0</entryPointShort>
<exitStopFull>0</exitStopFull>
<exitStopPartial>0</exitStopPartial>
</DecisionBar>