久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='XR9YX'></tfoot>

    <i id='XR9YX'><tr id='XR9YX'><dt id='XR9YX'><q id='XR9YX'><span id='XR9YX'><b id='XR9YX'><form id='XR9YX'><ins id='XR9YX'></ins><ul id='XR9YX'></ul><sub id='XR9YX'></sub></form><legend id='XR9YX'></legend><bdo id='XR9YX'><pre id='XR9YX'><center id='XR9YX'></center></pre></bdo></b><th id='XR9YX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='XR9YX'><tfoot id='XR9YX'></tfoot><dl id='XR9YX'><fieldset id='XR9YX'></fieldset></dl></div>

        <bdo id='XR9YX'></bdo><ul id='XR9YX'></ul>
        <legend id='XR9YX'><style id='XR9YX'><dir id='XR9YX'><q id='XR9YX'></q></dir></style></legend>
      1. <small id='XR9YX'></small><noframes id='XR9YX'>

        將 XML 轉(zhuǎn)換為通用列表

        Converting a XML to Generic List(將 XML 轉(zhuǎn)換為通用列表)

          <tbody id='aGj7g'></tbody>

        <small id='aGj7g'></small><noframes id='aGj7g'>

          <bdo id='aGj7g'></bdo><ul id='aGj7g'></ul>
          <tfoot id='aGj7g'></tfoot>

            <i id='aGj7g'><tr id='aGj7g'><dt id='aGj7g'><q id='aGj7g'><span id='aGj7g'><b id='aGj7g'><form id='aGj7g'><ins id='aGj7g'></ins><ul id='aGj7g'></ul><sub id='aGj7g'></sub></form><legend id='aGj7g'></legend><bdo id='aGj7g'><pre id='aGj7g'><center id='aGj7g'></center></pre></bdo></b><th id='aGj7g'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='aGj7g'><tfoot id='aGj7g'></tfoot><dl id='aGj7g'><fieldset id='aGj7g'></fieldset></dl></div>
              <legend id='aGj7g'><style id='aGj7g'><dir id='aGj7g'><q id='aGj7g'></q></dir></style></legend>

                • 本文介紹了將 XML 轉(zhuǎn)換為通用列表的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在嘗試將 XML 轉(zhuǎn)換為列表

                  I am trying to convert XML to List

                  <School>
                    <Student>
                      <Id>2</Id>
                      <Name>dummy</Name>
                      <Section>12</Section>
                    </Student>
                    <Student>
                      <Id>3</Id>
                      <Name>dummy</Name>
                      <Section>11</Section>
                    </Student>
                  </School>
                  

                  我使用 LINQ 嘗試了一些事情,但對(duì)繼續(xù)進(jìn)行不是很清楚.

                  I tried few things using LINQ and am not so clear on proceeding.

                  dox.Descendants("Student").Select(d=>d.Value).ToList();
                  

                  計(jì)數(shù)為 2,但值類似于 2dummy12 3dummy11

                  Am getting count 2 but values are like 2dummy12 3dummy11

                  是否可以將上述 XML 轉(zhuǎn)換為具有 Id、Name 和 Section 屬性的 Student 類型的通用列表?

                  Is it possible to convert the above XML to a generic List of type Student which has Id,Name and Section Properties ?

                  我可以實(shí)現(xiàn)的最佳方式是什么?

                  What is the best way I can implement this ?

                  推薦答案

                  可以創(chuàng)建匿名類型

                  var studentLst=dox.Descendants("Student").Select(d=>
                  new{
                      id=d.Element("Id").Value,
                      Name=d.Element("Name").Value,
                      Section=d.Element("Section").Value
                     }).ToList();
                  

                  這將創(chuàng)建一個(gè)匿名類型列表..

                  This creates a list of anonymous type..

                  如果要?jiǎng)?chuàng)建學(xué)生類型列表

                  If you want to create a list of Student type

                  class Student{public int id;public string name,string section}
                  
                  List<Student> studentLst=dox.Descendants("Student").Select(d=>
                  new Student{
                      id=d.Element("Id").Value,
                      name=d.Element("Name").Value,
                      section=d.Element("Section").Value
                     }).ToList();
                  

                  這篇關(guān)于將 XML 轉(zhuǎn)換為通用列表的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Ignore whitespace while reading XML(讀取 XML 時(shí)忽略空格)
                  XML to LINQ with Checking Null Elements(帶有檢查空元素的 XML 到 LINQ)
                  Reading XML with unclosed tags in C#(在 C# 中讀取帶有未閉合標(biāo)簽的 XML)
                  Parsing tables, cells with Html agility in C#(在 C# 中使用 Html 敏捷性解析表格、單元格)
                  delete element from xml using LINQ(使用 LINQ 從 xml 中刪除元素)
                  Parse malformed XML(解析格式錯(cuò)誤的 XML)

                    <bdo id='xJYPv'></bdo><ul id='xJYPv'></ul>
                    <legend id='xJYPv'><style id='xJYPv'><dir id='xJYPv'><q id='xJYPv'></q></dir></style></legend>
                    <i id='xJYPv'><tr id='xJYPv'><dt id='xJYPv'><q id='xJYPv'><span id='xJYPv'><b id='xJYPv'><form id='xJYPv'><ins id='xJYPv'></ins><ul id='xJYPv'></ul><sub id='xJYPv'></sub></form><legend id='xJYPv'></legend><bdo id='xJYPv'><pre id='xJYPv'><center id='xJYPv'></center></pre></bdo></b><th id='xJYPv'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xJYPv'><tfoot id='xJYPv'></tfoot><dl id='xJYPv'><fieldset id='xJYPv'></fieldset></dl></div>

                      • <small id='xJYPv'></small><noframes id='xJYPv'>

                          <tbody id='xJYPv'></tbody>
                        <tfoot id='xJYPv'></tfoot>

                          1. 主站蜘蛛池模板: 免费观看的av | 欧美黄色片 | 久久久精彩视频 | 乱一性一乱一交一视频a∨ 色爱av | 日本不卡一区二区三区在线观看 | 夜夜操天天艹 | 一级毛片在线播放 | 国产美女一区二区 | 亚洲欧美日本在线 | 男女视频在线观看免费 | 久久区二区 | 国产色在线 | 欧美一级精品片在线看 | 综合自拍| 国产精品18久久久久久久 | 欧美一区二 | 欧美一级高清片 | 日日夜夜精品 | 九九久久99| 天天躁天天操 | 欧美在线看片 | 一区二区三区免费网站 | 91精品国产91久久久久久丝袜 | 国产黄色网 | 91xxx在线观看 | 精品国产乱码久久久久久丨区2区 | 一本一道久久a久久精品蜜桃 | 亚洲国产精品一区二区久久 | 黄片毛片免费观看 | 国产视频h | 2022精品国偷自产免费观看 | 一a一片一级一片啪啪 | 91精品久久久久久久久中文字幕 | 欧美激情欧美激情在线五月 | 国产高清精品一区二区三区 | 午夜资源 | 国产在线资源 | 国产乱码精品一区二区三区忘忧草 | 精品美女视频在免费观看 | 羞羞色网站 | 成人在线观看中文字幕 |