linq學習筆記2
2013-04-17 11:32
155 查看
VB中對linq to xml 的支持
1. XML字面值
2. 動態XML
3. 與Linq的結合, 產生XML
4. 使用linq 讀取XML
child axis:<Genre> 會轉化為Elements() 方法
attribute axis: @Tilte 會轉化為Attribute() 方法
descendants axis: 可以取得一個element所有的子孫 , 用 ... 表示 與child axis類似 如: movies...<Diretor>
VB中沒有 yield關鍵字
VB中沒有匿名方法, 可以使用lambda表達式代替, 但lambda表達式無法取代 匿名delegate
後續的學習中會詳細的介紹Linq To XML
1. XML字面值
dim book = <book title="title"> <Author>dm</Author> </book>
2. 動態XML
dim tag = "Description" dim simple = <<%= tag %>>description simple </> '注意<%= %> 要有空格 '結束標籤 </>
3. 與Linq的結合, 產生XML
dim book = _ <book> <%= from person in team _ where person.Role= "Author" _ select <author><%= person.Name %></author> %> </book>
4. 使用linq 讀取XML
child axis:<Genre> 會轉化為Elements() 方法
attribute axis: @Tilte 會轉化為Attribute() 方法
descendants axis: 可以取得一個element所有的子孫 , 用 ... 表示 與child axis類似 如: movies...<Diretor>
dim movies = _ <Movies> <Movie Title="test"> <Genre>Gim</Genre> <Genre>Drama</Genre> <Diretor>David</Diretor> </Movie> </Movies> dim a = from movie in movies.<Movie> _ where movie.@Title ="test" _ select movie).First() '取得所有Genre '相當於: a.Elements("Genre") for each g in a.<Genre> ... next
VB中沒有 yield關鍵字
VB中沒有匿名方法, 可以使用lambda表達式代替, 但lambda表達式無法取代 匿名delegate
後續的學習中會詳細的介紹Linq To XML
相关文章推荐
- linq學習筆記1
- DIV+CSS的學習筆記1
- web學習筆記001
- 開發動態SQL 學習筆記
- Gazebo機器人仿真學習探索筆記(一)安裝與使用
- android學習筆記之XML解析
- twisted學習筆記二--twisted的那三板斧
- Protocol Buffer(Google) 學習筆記一
- C#學習筆記之數組操作
- twisted Deferred學習筆記一
- 【學習筆記】UIScrollView 方法
- RDLC 報表學習筆記—子報表
- Gazebo機器人仿真學習探索筆記(二)基本使用說明
- Gazebo機器人仿真學習探索筆記(四)模型編輯
- Oracle 學習筆記003 SQL基礎
- 【學習筆記】NS中輸出格式
- Gazebo機器人仿真學習探索筆記(二)基本使用說明
- Gazebo機器人仿真學習探索筆記(四)模型編輯
- Oracle 學習筆記001-緒論
- Oracle 學習筆記004 SQL基礎