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. C#
  4. deserialize to C# class from external config file?

deserialize to C# class from external config file?

Scheduled Pinned Locked Moved C#
csharpxmljsonhelpquestion
1 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.
  • T Offline
    T Offline
    Tom Paluzzi
    wrote on last edited by
    #1

    I'm using System.Configuration in .NET 2.0 to load in values from an externally specified config file and deserialize them into a C# class. During deserialization, I'm getting an exception thrown by .NET It's having a problem with the element seen below. I've tried different things, but still I can't get the deserialize to succeed. Here's the problem in detail below. Can anybody tell me what I'm doing wrong? Shouldn't [xmlArray] work? Thx, Tom The app.config file looks like this:

    DataAccess.config looks like this: The C# class looks like this: using System; using System.Xml.Serialization; using System.Configuration; namespace Framework.Data { /// /// Represents the root of all data access configuration information. /// public class DataAccessConfig : ConfigurationSection { #region Constructor(s) /// /// Initializes a new instance of the class. /// public DataAccessConfig() { _sectionName = _defaultSectionName; } #endregion #region Config Manager private const string _defaultSectionName = "dataAccessSection"; private string _sectionName; #region Connection Config private ConnectionConfigCollection _connections = new ConnectionConfigCollection(); /// /// Gets or sets the collection of connection configuration items associated with this application. /// /// The collection of connection configuration items associated with this application. [XmlArray("connections")] [XmlArrayItem("c

    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