Forum » Programska oprema » c# ConfigSection
c# ConfigSection

detroit ::
Delam config section v app.configu
 
 
 
v app.configu imam
 
  
to je nek class pač in v glavnem classu
 
Ta zadnja vrstica vrne Configuration system failed to initialize. Ali kdo opazi kako napako
v app.configu imam
<configSections>
      <section name="AConfigSection" type="TestGJILoad.AConfigSection, TestGJILoad"/>
  </configSections>
  <AConfigSection>
    <UrlElement name="FCL1 oz kaj pa vem"  url="www.abc.com"/>
  </AConfigSection>using System.Configuration;
namespace TestGJILoad
{
    public class UrlElement : ConfigurationElement
    {
        [ConfigurationProperty("name", IsRequired = true)]
        public string Name
        {
            get { return (string)this["name"]; }
            set { this["name"] = value; }
        }
        [ConfigurationProperty("url")]
        public string Url
        {
            get { return (string)this["url"]; }
            set { this["url"] = value; }
        }
    }
    public class AConfigSection : ConfigurationSection
    {
        [ConfigurationProperty("url")]
        public UrlElement AUrl
        {
            get { return (UrlElement)this["url"]; }
            set { this["url"] = value; }
        }
    }
}to je nek class pač in v glavnem classu
 AConfigSection config = (AConfigSection)System.Configuration.ConfigurationManager.GetSection("AConfigSection");Ta zadnja vrstica vrne Configuration system failed to initialize. Ali kdo opazi kako napako
Skero
- spremenil: detroit ()
Vredno ogleda ...
| Tema | Ogledi | Zadnje sporočilo | |
|---|---|---|---|
| Tema | Ogledi | Zadnje sporočilo | |
| » | [C#] WPF vprašanjaOddelek: Programiranje | 1243 (865) | Ciklamen | 
| » | c# seminarskaOddelek: Programiranje | 3002 (2675) | tuned | 
| » | [C#] DeserializacijaOddelek: Programiranje | 2048 (1651) | Cvenemir | 
| » | [c#] Ustvarjanje objekta v drugem razreduOddelek: Programiranje | 1777 (1722) | Cvenemir | 
| » | [c#] Vprašanje glede release verzije aplikacijeOddelek: Programiranje | 1689 (1513) | Ericssony |