從SharePoint Web服務返回的XML元素z:行中有2個單獨的國家/地區屬性。如何在使用LINQ的c#中加入兩個列表<string>
var homeCountry = (from xml in doc.Descendants(z + "row") select xml.Attribute("ows_Country").Value).Distinct();
var covCountry = (from xml in doc.Descendants(z + "row")
where xml.Attribute("ows_Coverage_x0020_Area_x0020_by_x00").Value != ""
select xml.Attribute("ows_Coverage_x0020_Area_x0020_by_x00").Value);
現在我想合併兩個列表,以獲得不同的國家名稱並加載dropdow dox。
distinctCountriesList.Add("");
distinctCountriesList.Sort();
country.DataSource = distinctCountriesList.Distinct();
country.DataBind();
試穿homeCountry和covCountry –