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
  • 相关阅读:
    采用springboot+flowable快速实现工作流
    07 Sublime Text3常用快捷键
    06 解决Sublime Text3输入法不跟随的问题
    04 Storage and Calculation C语言中的存储和计算
    05 sublime环境配置及编译运行后输出中文乱码的解决
    04 sublime text 3在线安装package control插件,之后安装主题插件和ConvertToUTF8 插件
    03 sublime text3下配置Java的编译运行环境
    02 sublime text3下配置Python的编译运行环境
    01 sublime text3下配置c/c++ 的编译运行环境
    03 Comments in C Programming C编程中的注释
  • 原文地址:https://www.cnblogs.com/feishunji/p/1538574.html
Copyright © 2011-2022 走看看