I m not sure if I got the right idea of how array.where() works. I ve got an array filled with Spectrum.cs objects. each spectrum contains a filename-property.
我的特征. filename; // string
现在我有一个字符串值, 我想与数组中每个对象进行比较, 以找出它是否有相同的文件名 。 正如我所理解的, 它应该这样工作 :
Spectrum bgSpec = new Spectrum(); //Has a filename
Spectrum[] currentSpectra; //Array filled with Spectra
//Somehow this doesn t seem to work. Propably due to the returnvalue for where() which seems //to be IEnumerable.
Spectrum tempSpectrum = currentSpectra.Where<Spectrum>(c => c.filename == bgSpec);
我可能把一切都弄错了,如果有人能指出它是什么或如何正确行事,我会非常感激。
Thanks in advance, BC++