<configSections> 
<section name="MenuConfiguration" type="WindowsApplication4.NewMenuSetion,WindowsApplication4,PublicKeyToken=null" /> 
</configSections> 
<MenuConfiguration> 
<Menu> 
<MenuPopup Caption="弹出菜单" /> 
<MenuPopup Caption="弹出菜单2" /> 
<MenuButton Caption="普通菜单" /> 
<MenuButton Caption="普通菜单2" /> 
</Menu> 
</MenuConfiguration> 请问下这中情况能实现么 MenuPopup MenuButton 都要求是能重复的!!
怎么实现 给点提示 邮箱[email protected]

解决方案 »

  1.   

    完全可以,config文件其实就是一个xml文件,你把它当成xml文件来操作就可以了,具体取值的 话就使用 xpath
      

  2.   

    不过如果楼主想要取caption中的值得话,那么他们的xpath就相同了,也就是说只能取到一个值,
    楼主可以这样,加个关键字 如下<Menu>   
    <MenuPopup id="1"  Caption="弹出菜单"   />   
    <MenuPopup id="2"  Caption="弹出菜单2"   />   
    <MenuButton id="1" Caption="普通菜单"   />   
    <MenuButton id="2"  Caption="普通菜单2"   />   
    </Menu>
      

  3.   

    忘记说了 这是要写成CONFIG 要用ConfigurationSection 做!  
      

  4.   

       [ConfigurationProperty("", IsDefaultCollection = true)]
            public MenuPopupElementCollection MenuPopup
            {
                get
                {
                    return (MenuPopupElementCollection)base[""];
                }
            }这样只能做MenuPopup的 我想知道MenuButton怎么做! 如果再写成
     [ConfigurationProperty("",  IsDefaultCollection = true)]
            public MenuButtonElementCollection MenuButton
            {
                get
                {
                    return (MenuButtonElementCollection)base[""];
                }        }就会错!  请高手指点!!!