本文介绍了如何在LINQ中编写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 如何在LINQ中编写以下语句 How can i write the below statement in LINQXmlNode userNode = resultNode.SelectSingleNode("generalinfo", nsmgr); if (userNode != null) { genInfoViewModel.StartDate = userNode.Attributes["effectivedate"] != null ? userNode.Attributes["effectivedate"].Value : string.Empty; genInfoViewModel.TotRetailSquareFeet = userNode.Attributes["retailsqft"] != null ? userNode.Attributes["retailsqft"].Value : string.Empty; genInfoViewModel.TotalSquareFeet = userNode.Attributes["totalsqft"] != null ? userNode.Attributes["totalsqft"].Value : string.Empty; genInfoViewModel.CityPopulation = userNode.Attributes["citypopulation"] != null ? userNode.Attributes["citypopulation"].Value : string.Empty; genInfoViewModel.GunLicense = userNode.Attributes["gunlicense"] != null ? userNode.Attributes["gunlicense"].Value : string.Empty; genInfoViewModel.TaxRegistration = userNode.Attributes["taxregnum"] != null ? userNode.Attributes["taxregnum"].Value : string.Empty; } 我的尝试: userNode.Attributes [effectivedate]!= null?userNode.Attributes [effectivedate]。FirstChild What I have tried:userNode.Attributes["effectivedate"]!=null?userNode.Attributes["effectivedate"].FirstChild推荐答案 这篇关于如何在LINQ中编写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-15 22:29