zoukankan      html  css  js  c++  java
  • LINQ and some difference between XDocument and XElement

    app.config
    Winform code:
                XElement config = XElement.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
                
    foreach (XElement xe in config.Elements())
                    textBox1.Text 
    += (xe.Name.ToString() + Environment.NewLine);

                XDocument xd 
    = XDocument.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
                
    foreach (XElement xe in xd.Elements())
                    textBox1.Text 
    += (xe.Name.ToString() + Environment.NewLine);

    Output:
    MyConfig
    configSections
    connectionStrings
    configuration
    some other XLINQ samples
    There, u can c the differences between XElement and XDocument :)
    In the past, I wrote some XML operation tutorials in non-LINQ time: http://hi.baidu.com/feishunji/blog/category/Xml

    Marius Bancila has also contributed some good introduction articles of LINQ:
    Introduction to LINQ, Part 1: LINQ to Objects
    Introduction to LINQ, Part 2: LINQ to XML
    Introduction to LINQ, Part 3: LINQ to SQL
  • 相关阅读:
    高德地图API1.4.15较1.4.12的marker属性取值发生变化
    Cesium加载地图提示RangeError:Invalid of array List
    layui分页功能使用——点页码再查询
    设置layui的自定义样式
    页面引入layui.js后提示layui未定义
    SQL语句出现sql关键字
    vs2017 vs2019配置sqlite3连接引擎(驱动)指南(二)vs2019续集
    vs2017 vs2019配置sqlite3连接引擎(驱动)指南(一)vs2019篇
    Qt C++ QDataStream和QBuffer
    Qt C++不规则窗口
  • 原文地址:https://www.cnblogs.com/feishunji/p/1538574.html
Copyright © 2011-2022 走看看