Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. System.Configuration.AppSettingsReader with Reflection

System.Configuration.AppSettingsReader with Reflection

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharptutorialquestionworkspace
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gonzalo Brusella
    wrote on last edited by
    #1

    Here is the thing: I reflect a class library assembly and instance a object without problems, but when I use a System.Configuration.AppSettingsReader object (to get the reflected module config), the readed config is the one of the Main app and not the one of the class library assembly. Any idea on how to solve this? I'm using .Net 2.0 Thanks I'm on a Fuzzy State: Between 0 an 1

    G 1 Reply Last reply
    0
    • G Gonzalo Brusella

      Here is the thing: I reflect a class library assembly and instance a object without problems, but when I use a System.Configuration.AppSettingsReader object (to get the reflected module config), the readed config is the one of the Main app and not the one of the class library assembly. Any idea on how to solve this? I'm using .Net 2.0 Thanks I'm on a Fuzzy State: Between 0 an 1

      G Offline
      G Offline
      Gonzalo Brusella
      wrote on last edited by
      #2

      I solved myself: private void CreateSchedule() { System.Reflection.Assembly ASM = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.FileInfo FileInfo = new System.IO.FileInfo(ASM.Location + ".config"); System.Xml.XmlDocument XmlDocument = new System.Xml.XmlDocument(); XmlDocument.Load(FileInfo.FullName); string Value; foreach (System.Xml.XmlNode Node in XmlDocument.SelectNodes("configuration/appSettings/add")) { Value = Node.Attributes.GetNamedItem("value").Value; switch (Node.Attributes.GetNamedItem("key").Value) { case "XXXXXXX": // My code here break; case "YYYYYYY": // My code here break; default: break; } } } I'm on a Fuzzy State: Between 0 an 1

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups