另一个“对象不包含X的定义”

我看到了很多关于这个问题的主题:

“对象不包含X的定义,并且没有扩展方法X接受Object类型的第一个参数”

但他们都没有解决我的问题。

情况:我想保存3个系列的DataPoints。 因此我制作了一个包含该系列的列表:

List filesToBeStored; public OxyPlot.Series.DataPointSeries saveAnalyseBSITotal; public OxyPlot.Series.DataPointSeries saveAnalyseSBSI; public OxyPlot.Series.DataPointSeries saveAnalyseTBSI; 

在Form.cs中,我调用SaveFile(…):

  for (int i = 0; i < plotSBSIBandsA.Model.Series.Count; i++) { OxyPlot.Series.DataPointSeries sA = (plotSBSIBandsA.Model.Series[i] as OxyPlot.Series.DataPointSeries); OxyPlot.Series.DataPointSeries sB = (plotSBSIBandsB.Model.Series[i] as OxyPlot.Series.DataPointSeries); sB.Points.Clear(); for (int j = 0; j < sA.Points.Count; j++) { sB.Points.Add(new OxyPlot.DataPoint(sA.Points[j].X, sA.Points[j].Y)); } } if(saveButtonClicked) {this.SaveFile(sB)} 

完整的Save-Class是:

  using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BSIAnalyzer { class SaveFile { List filesToBeStored; public OxyPlot.Series.DataPointSeries saveAnalyseBSITotal; public OxyPlot.Series.DataPointSeries saveAnalyseSBSI; public OxyPlot.Series.DataPointSeries saveAnalyseTBSI; public SaveFile(OxyPlot.Series.DataPointSeries sA) { for (int i = 0; i < sA.Points.Count; i++) { saveAnalyseBSITotal.Points.Add(new OxyPlot.DataPoint(sA.Points[i].X, sA.Points[i].Y)); } } public SaveFile(List series) { filesToBeStored.Insert(0, saveAnalyseBSITotal); filesToBeStored.Insert(1, saveAnalyseSBSI); filesToBeStored.Insert(2, saveAnalyseTBSI); for (int k = 0; k < series.Count; k++) { filesToBeStored[k].Points.Add(new OxyPlot.DataPoint(series[k].Points.X, series[k].Points.Y)); } } } } 

在te“k”的forloop中我得到了错误。