zoukankan      html  css  js  c++  java
  • C#笔记 通用文件的读取之二——XML文件的读取与写入

          在设计程序的时候,对于一些变化性较强的数据,可以保存在XML文件中,以方便用户修改。尤其是对于一些软硬件的配置文件,很多都选择了用XML文件来存取。XML文件简单易用,而且可以在任何应用程序中读写数据,所以它是一种重要的通用文件。下面的例子简单演示了XML文件的创建、读取和写入。
    XmlProcess类中的Using指令
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    using System.Xml;

    XmlProcess类
    Code

    读取出的数据仍然缓冲在泛型类List中,数据记录保存在Student类的实例中:
    Student类:
     class Student
        
    {
            
    public int 学号 getset; }
            
    public string 姓名 getset; }
            
    public int 成绩 getset; }
        }

    XML文件的内容:
    Code
    该示例演示的是创建XML文件并在其中手动插入数据。
    如果XML文件已经存在,则可以直接对其进行读取及各种其他操作,具体操作请参见其他博友的博客内容。


  • 相关阅读:
    react-native Image resizeMode
    常见的前端设计模式
    Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
    Error: [mobx] Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended.
    react-native 扫一扫功能(二维码扫描)功能开发
    字符串截取 及 substr 和 substring 的区别
    POST请求的forHTTPHeaderField
    使用MDScratchImageView实现刮奖效果
    计算Pan手势到指定点的角度
    CAShapeLayer的使用[2]
  • 原文地址:https://www.cnblogs.com/gb2013/p/1577855.html
Copyright © 2011-2022 走看看