I want to have a default value for a boolean crossover of false
How can I initialize it?
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 entryPointLong
{get;set;}
public double entryPointShort
{get;set;}
}
Apart from the fact that the default value is false, there are two options. Obviously they are redundant, but if you wanted the default value to true you could use either method.
Either don’t use an auto-implemented property, instead using a backing property;
or in the constructor;