zoukankan      html  css  js  c++  java
  • 读写配置文件类和全局类调用的具体用法

    1.读取配置文件(app.config)
    1ConfigSettings settings=Global.GetInstance().Settings;
    2    //textbox赋值        tbUserName.Text=settings.GetString(SettingKey.MailUserName.ToString());
    3            tbPwd.Text=settings.GetString(SettingKey.MailPassWord.ToString());
    4            tbPOP3.Text=settings.GetString(SettingKey.MailPOP3ServerAddress.ToString());
    5            tbSMTP.Text=settings.GetString(SettingKey.MailSMTPServerAddress.ToString());
    6            tbPort.Text=settings.GetString(SettingKey.MailPOP3Port.ToString());
    7            tbReceiveAddress.Text=settings.GetString(SettingKey.MailRecipientsAddress.ToString());
    8            tbMailAddress.Text=settings.GetString(SettingKey.MailAddress.ToString());

    2.设置配置文件中各项值
    1ConfigSettings settings=Global.GetInstance().Settings;
    2                settings.SetValue(SettingKey.MailUserName.ToString(),tbUserName.Text.Trim());
    3                settings.SetValue(SettingKey.MailPassWord.ToString(),tbPwd.Text.Trim());
    4                settings.SetValue(SettingKey.MailPOP3ServerAddress.ToString(),tbPOP3.Text.Trim());
    5                settings.SetValue(SettingKey.MailSMTPServerAddress.ToString(),tbSMTP.Text.Trim());
    6                settings.SetValue(SettingKey.MailPOP3Port.ToString(),tbPort.Text.Trim());
    7                settings.SetValue(SettingKey.MailRecipientsAddress.ToString(),tbReceiveAddress.Text.Trim());
    8                settings.SetValue(SettingKey.MailAddress.ToString(),tbMailAddress.Text.Trim());

    3.注意:调用此类前要using configSetting所在的命名空间,此例中为sss_system.class;
  • 相关阅读:
    2020年“3D视觉工坊”视频号最受欢迎视频 Top 10!
    缓存一致性解决方案杂谈
    Mybatis的@Param注解在多参数时候不写,可以正确执行。
    Redis设计与实现之简单动态字符串
    YApi mac上部署
    拖拽方式生成Vue用户界面
    终于可以愉快的撸Java异步代码了!
    Windows 取证之ShellBags
    初识Fastjson漏洞(环境搭建及漏洞复现)
    mongo-express 远程代码执行漏洞分析
  • 原文地址:https://www.cnblogs.com/telephoner/p/174591.html
Copyright © 2011-2022 走看看