C# check an element exists while using LINQ to XML

前端 未结 6 1026
慢半拍i
慢半拍i 2021-01-02 08:32

OK, bit of a random question, but the best way to do this is to just add the code, you\'ll be able to see what I mean straight away:

XML:



        
6条回答
  •  醉酒成梦
    2021-01-02 08:38

    You should be able to just add a check for null

    where c.Element("SuperType") != null 
    && [your other criteria]
    

提交回复
热议问题