I am trying to query some informations from xml with linq but I am getting error like this – Yes I have defined – using System.Linq
Could you tell me, where is a problem?
Thanks
Error 1 Could not find an
implementation of the query pattern
for source type
‘urn.P.IEEE.Item1671.Item2.Item2008.Item02.InstrumentDescription.InstrumentDescription’.
‘Select’ not found. D:\Documents and
Settings\e539951\my documents\visual
studio
2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs 28 36 WindowsFormsApplication1
InstrumentDescription test = InstrumentDescription.Load(openFileDialog1.FileName);
var query = from b in test
select new { b.Identification };
In your code
testrepresents just the root element of the document, so you can’t use LINQ on it – it’s not an sequence.What you should do depends on how your XSD looks like. For example, if there can be multiple
Identificationelements under the rootInstrumentDescriptionelement, then just accessingtest.Identiticationgives you the list.