新聞中心
本篇內(nèi)容介紹了“如何用LINQ進(jìn)行查詢”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)與策劃設(shè)計(jì),孝義網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:孝義等地區(qū)。孝義做網(wǎng)站價(jià)格咨詢:18980820575
LINQ to XML 提供使用 .NET 語言集成查詢 (LINQ) Framework 的內(nèi)存中 XML 編程接口。LINQ to XML 使用***的 .NET Framework 語言功能,相當(dāng)于更新的和重新設(shè)計(jì)的文檔對(duì)象模型 (DOM) XML 編程接口。
LINQ 系列技術(shù)提供了針對(duì)對(duì)象 (LINQ to Objects)、關(guān)系數(shù)據(jù)庫 (LINQ to SQL) 和 XML (LINQ to XML) 的一致查詢體驗(yàn)。
現(xiàn)在有一個(gè)專門的System.Xml.Linq的命名空間
XDocument srcTree = new XDocument( new XComment("This is a comment"), new XElement("Root", new XElement("Child1", "data1"), new XElement("Child2", "data2"), new XElement("Child3", "data3"), new XElement("Child2", "data4"), new XElement("Info5", "info5"), new XElement("Info6", "info6"), new XElement("Info7", "info7"), new XElement("Info8", "info8"), new XElement("Test","Chenxizhang",new XAttribute("ID",10248)) ) ) Console.WriteLine(srcTree); XDocument doc = new XDocument( new XComment("This is a comment"), new XElement("Root", from el in srcTree.Element("Root").Elements() where ((string)el).StartsWith("data") select el ) ); Console.WriteLine(doc); Console.Read();
使用命名空間的例子
XNamespace aw = "http://www.adventure-works.com";
XElement root = new XElement(aw + "Root",new XAttribute(XNamespace.Xmlns + "aw",
"http://www.adventure-works.com"),new XElement(aw + "Child", "child content"));Console.WriteLine(root);
Console.Read();
“如何用LINQ進(jìn)行查詢”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!
新聞名稱:如何用LINQ進(jìn)行查詢
本文URL:http://www.ef60e0e.cn/article/jgdigh.html