• 大小: 0.19M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: C#  Config  配置  

资源简介

这篇文章主要介绍了C#中读写App.config配置文件的方法,代码实例演示如何将主要信息保存至App.config中,可以减少每次启动程序时固定信息的重复录入。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Windows.Forms;

namespace SettingConfiguration
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Modify_Click(object sender EventArgs e)
        {
            name.Enabled = true;
            sex.Enabled = true;
            age.Enabled = true;
            department.Enabled = true;
            phone.Enabled = true;
            email.Enabled = true;
            MessageBox.Show(“请录入个人信息!“);
        }

        private void Save_Click(object sender EventArgs e)
        {
 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-04-01 11:37  SettingConfiguration\
     目录           0  2020-04-01 11:37  SettingConfiguration\.vs\
     目录           0  2020-04-01 11:37  SettingConfiguration\.vs\SettingConfiguration\
     目录           0  2020-04-01 11:38  SettingConfiguration\.vs\SettingConfiguration\v16\
     文件       47104  2020-04-01 14:50  SettingConfiguration\.vs\SettingConfiguration\v16\.suo
     目录           0  2020-04-01 11:38  SettingConfiguration\.vs\SettingConfiguration\v16\Server\
     目录           0  2020-04-01 14:50  SettingConfiguration\.vs\SettingConfiguration\v16\Server\sqlite3\
     文件           0  2020-04-01 11:38  SettingConfiguration\.vs\SettingConfiguration\v16\Server\sqlite3\db.lock
     文件      573440  2020-04-01 14:49  SettingConfiguration\.vs\SettingConfiguration\v16\Server\sqlite3\storage.ide
     目录           0  2020-04-01 14:35  SettingConfiguration\SettingConfiguration\
     文件         341  2020-04-01 14:35  SettingConfiguration\SettingConfiguration\App.config
     目录           0  2020-04-01 11:37  SettingConfiguration\SettingConfiguration\bin\
     目录           0  2020-04-01 14:50  SettingConfiguration\SettingConfiguration\bin\Debug\
     文件       12288  2020-04-01 12:17  SettingConfiguration\SettingConfiguration\bin\Debug\SettingConfiguration.exe
     文件         355  2020-04-01 14:50  SettingConfiguration\SettingConfiguration\bin\Debug\SettingConfiguration.exe.config
     文件       30208  2020-04-01 12:17  SettingConfiguration\SettingConfiguration\bin\Debug\SettingConfiguration.pdb
     文件        3087  2020-04-01 12:17  SettingConfiguration\SettingConfiguration\Form1.cs
     文件        9072  2020-04-01 12:16  SettingConfiguration\SettingConfiguration\Form1.Designer.cs
     文件        5817  2020-04-01 12:16  SettingConfiguration\SettingConfiguration\Form1.resx
     目录           0  2020-04-01 11:37  SettingConfiguration\SettingConfiguration\obj\
     目录           0  2020-04-01 12:17  SettingConfiguration\SettingConfiguration\obj\Debug\
     文件         979  2020-04-01 11:46  SettingConfiguration\SettingConfiguration\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        7213  2020-04-01 11:51  SettingConfiguration\SettingConfiguration\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件          42  2020-04-01 11:47  SettingConfiguration\SettingConfiguration\obj\Debug\SettingConfiguration.csproj.CoreCompileInputs.cache
     文件        1365  2020-04-01 12:00  SettingConfiguration\SettingConfiguration\obj\Debug\SettingConfiguration.csproj.FileListAbsolute.txt
     文件        1012  2020-04-01 12:17  SettingConfiguration\SettingConfiguration\obj\Debug\SettingConfiguration.csproj.GenerateResource.cache
     文件         424  2020-04-01 11:51  SettingConfiguration\SettingConfiguration\obj\Debug\SettingConfiguration.csprojAssemblyReference.cache
     文件       12288  2020-04-01 12:17  SettingConfiguration\SettingConfiguration\obj\Debug\SettingConfiguration.exe
     文件         180  2020-04-01 12:17  SettingConfiguration\SettingConfiguration\obj\Debug\SettingConfiguration.Form1.resources
     文件       30208  2020-04-01 12:17  SettingConfiguration\SettingConfiguration\obj\Debug\SettingConfiguration.pdb
     文件         180  2020-04-01 12:00  SettingConfiguration\SettingConfiguration\obj\Debug\SettingConfiguration.Properties.Resources.resources
............此处省略10个文件信息

评论

共有 条评论