Q:

C# List

There's a class:
public class SampleInformation
{
    public string Nutrient { get; set; }
    public decimal NutrientTotal { get; set; }
    public int NoSamples { get; set; }
    public decimal Average { get; set; }
    public decimal StandardDeviation { get; set; }
    public decimal CoVariance { get; set; }
    public decimal PSD { get; set; }
    public decimal NSD { get; set; }
}

and have created a list of the same.
Now while adding values, I would like to have 
PSD = Average + StandardDeviation and
NSD = Average - StandardDeviation
My code goes as:
sampleInfoList.Add(new SampleInformation
            {
                Nutrient = "Dry Matter",
                NoSamples = CalculateSampleCount(dryMatter),
                Average = CalculateAverage(dryMatter),
                StandardDeviation = CalculateStandardDeviation(dryMatter),
                CoVariance = CalculateCoVariance(dryMatter),
                NSD = 0,
                PSD = 0,
                NutrientTotal = 0
            });

How can I have something like
 sampleInfoList.Add(new SampleInformation
            {
                Nutrient = "Dry Matter",
                NoSamples = CalculateSampleCount(dryMatter),
                Average = CalculateAverage(dryMatter),
                StandardDeviation = CalculateStandardDeviation(dryMatter),
                CoVariance = CalculateCoVariance(dryMatter),
                NSD = Average - StandardDeviation,
                PSD = Average + StandardDeviation,
                NutrientTotal = 0
            });

I do not want to create another method and pass the list to calculate NSD and PSD.

A:

Create NSD and PSD as properties:
public class SampleInformation
{
    public string Nutrient { get; set; }
    public decimal NutrientTotal { get; set; }
    public int NoSamples { get; set; }
    public decimal Average { get; set; }
    public decimal StandardDeviation { get; set; }
    public decimal CoVariance { get; set; }
    public decimal PSD { get { return Average + StandardDeviation } }
    public decimal NSD { get { return Average - StandardDeviation } }
}

then it will be calculated for you and you can just add new instance like that:
sampleInfoList.Add(new SampleInformation
    {
        Nutrient = "Dry Matter",
        NoSamples = CalculateSampleCount(dryMatter),
        Average = CalculateAverage(dryMatter),
        StandardDeviation = CalculateStandardDeviation(dryMatter),
        CoVariance = CalculateCoVariance(dryMatter),
        NutrientTotal = 0
    });

