进一步扩展问题:
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 } }
}
上述课程计算平均值,SD,CoVar等。 上面的类把我输出为:
Nutrient | Average | # Samples | SD | CoVar
我想将上述内容扩展并将其绑定到列表
Nutrient | Average | # Samples | SD | CoVar | Item1 | Item2 | ...
XXX | Average | # Samples | SD | CoVar | Value for XXX for item 1 | Value for XXX for item 2 | ...
yyy | Average | # Samples | SD | CoVar | Value for YYY for item 1 | Value for YYY for item 2 | ...
任何快速帮助?
答案 0 :(得分:0)
通过以下方式创建SampleInformation对象列表:
List<SampleInformation> sampleList = new List<SampleInformation>(); //Creates the list
SampleInformation sample = new SampleInformation(); //Your object
sampleList.Add(sample); //Add your object to the list
这是你在找什么?