zoukankan      html  css  js  c++  java
  • 在app.config自定义一些配置信息

    我们想到的是将xml反序化.这们就可以得到这个对象了


        [Serializable()]
        [XmlRoot(
    "FetcherConfig")]
        
    public class FetcherConfiguration
        
    {
           
    ///某些属性

            
    public static FetcherConfiguration GetConfig()
            
    {
                
    if (instance_ == null)
                
    {
                   instance_ 
    = (FetcherConfiguration) ConfigurationSettings.GetConfig("FetcherConfig");
                }

                
    return instance_;
            }


              }

    这个xml的信息是从哪来呢?我们是把它放在app.config里的所以我们需要下面的Handler

    public class FetcherConfigSerializerSectionHandler:IConfigurationSectionHandler
        
    {
            
    IConfigurationSectionHandler Members
        }

    配置
    我们需要加入自己的<configSections>
    <section name="配置节的名字Xmlroot的名字" type="类的全名,类库的名字" />
    接下来就可以把一些信息放到
    <configuration>里了
    不懂得放哪些.可以先序列化一下你需要的哪个类.把信息复制过来就可以搞定了.
  • 相关阅读:
    host文件的用处
    探究 Flex 组件的生命周期
    QQ在开发中的应用
    转:linux进程间通信的几种机制的比较及适用场合
    转:Linux 2.4.x内核软中断机制
    转:PLL 锁相环
    转:LPC2214的PLL与定时器设置
    转: V4L2驱动程序架构
    转:linux select 多路复用机制
    [转] Linux 句柄是什么 ?
  • 原文地址:https://www.cnblogs.com/lovebanyi/p/741951.html
Copyright © 2011-2022 走看看