using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;namespace MyConfig
{
    class Staticvariable:ConfigurationSection
    {
        [ConfigurationProperty("id")]
        public int ID 
        {
            get 
            {
                return (int)this["id"];
            }
            set 
            {
                this["id"] = value; 
            }
        }
        [ConfigurationProperty("Value")]
        public int ID
        {
            get
            {
                return (int)this["Value"];
            }
            set
            {
                this["Value"] = value;
            }
        }
    }}

解决方案 »

  1.   

    几个知识:
    命名空间、继承、attribute和property。找一本书好好看看
      

  2.   

    [] 运算符
    http://msdn.microsoft.com/zh-cn/library/a3hd7ste(v=VS.80).aspx
      

  3.   

    [ConfigurationProperty("id")]
    就这个不明白帮解释一下不行吗?为什么老攻击我?我有不会的不能问问吗? 那本基础讲[ConfigurationProperty("id")]这种表达式是什么意思了?感谢给我帮助的人
      

  4.   

    China语言真是渤大精深啊,一个黑的能说成白的,一个字能造成人身攻击
      

  5.   

    书接触不到还有msdn,msdn接触不到还有网络,ConfigurationProperty msdn或者百度栏或google栏里输入就可以有详细介绍了。
      

  6.   

      自定义的重写部分,key 和value 的值
      

  7.   

      自定义的重写部分,key 和value 的值
      

  8.   

     楼主发表于:2010-07-08 11:16:20using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Configuration;namespace MyConfig
    {
      class Staticvariable:ConfigurationSection//自定义的配置节点
      {
      [ConfigurationProperty("id")]//有一个名字叫做id的配置特性,改特性的值会映射到这个类的ID这个Property上 ( id=123 ,那么这个类的实例的ID就会是123) 下同,但是这个类有点奇怪,为什么把id和value两个配置特性都映射到了ID上  public int ID  
      {
      get  
      {
      return (int)this["id"];
      }
      set  
      {
      this["id"] = value;  
      }
      }
      [ConfigurationProperty("Value")]
      public int ID
      {
      get
      {
      return (int)this["Value"];
      }
      set
      {
      this["Value"] = value;
      }
      }
      }}
     
     
      

  9.   

    我建议先搞下DEMO``然后再回头看一些基础的东西`