zoukankan      html  css  js  c++  java
  • 如何读写 app.config

    如何读写 app.config

    using System;
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    using System.Collections.Generic;
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    using System.Text;
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    using System.Configuration;
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    using System.Collections;
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    namespace ServicesConfiguration
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    {
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追    
    public class ConfigurationDispose
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追    
    {
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    public ConfigurationDispose()
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    {
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追         }

    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    #region GetConfiguration
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    /// <summary>
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    /// 取得appSettings里的值
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    /// </summary>
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    /// <param name="key"></param>
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    /// <returns></returns>

    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        public static string GetConfiguration(string key)
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    {
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追            
    return ConfigurationManager.AppSettings[key];
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追         }

    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    #endregion

    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    #region GetConfigurationList
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    /// <summary>
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    /// 取得appSettings里的值列表
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    /// </summary>
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    /// <param name="filePath">配置文件路径</param>
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    /// <returns>值列表</returns>

    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        public static KeyValueConfigurationCollection GetConfigurationList(string filePath)
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    {
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追             AppSettingsSection appSection
    = null;                       //AppSection对象
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
                 Configuration configuration = null;                         //Configuration对象     
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
                 KeyValueConfigurationCollection k = null;                   //返回的键值对类型
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追

    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追             configuration
    = ConfigurationManager.OpenExeConfiguration(filePath);
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追            
    //取得AppSettings节
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
                 appSection = (AppSettingsSection)configuration.Sections["appSettings"];
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追            
    //取得AppSetting节的键值对
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
                 k = appSection.Settings;
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追            
    return k;
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追                    
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追         }

    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追        
    #endregion

    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追
    VS2005 如何读写 app.config -  上年纪的程序员  - 有梦就追     

  • 相关阅读:
    彻底理解Netty
    linux netstat 统计连接数查看
    log4j2 自动删除过期日志文件配置及实现原理解析
    Log4j2的Policy触发策略与Strategy滚动策略配置详解
    @Accessors
    Caffeine Cache实战
    ws协议与http协议的异同
    深入理解Java:注解(Annotation)自定义注解入门
    java日志框架
    springboot 集成J2Cache
  • 原文地址:https://www.cnblogs.com/zzxap/p/2175880.html
Copyright © 2011-2022 走看看