• 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
  • 相关阅读:
    Java实现 LeetCode 450 删除二叉搜索树中的节点
    PHP mysqli_field_count() 函数
    PHP mysqli_fetch_row() 函数
    PHP mysqli_fetch_object() 函数
    PHP mysqli_fetch_lengths() 函数
    PHP mysqli_fetch_fields() 函数
    linux修改IP地址
    树莓派玩耍笔记2 -- 我的板子是正品么?(解答一些小问题)
    在一台server上部署多个Tomcat
    第十八篇:融汇贯通--谈USB Video Class驱动
  • 原文地址:https://www.cnblogs.com/feishunji/p/1538574.html
Copyright © 2020-2023  润新知