Click here to Skip to main content
15,897,315 members
Articles / Web Development / ASP.NET

Creating Custom Configurations

Rate me:
Please Sign up or sign in to vote.
4.47/5 (18 votes)
2 Sep 200410 min read 81K   1.7K   70  
Create isolated settings, strongly-typed objects and collections inside your web.config by leveraging the flexibility of .NET to create your own configuration sections and handler.
namespace ConfigurationSample {
   public class Server {
      #region Fields and Properties
      private string name;
      private string address;
      private bool isSource;

      public bool IsSource {
         get { return isSource; }
         set { isSource = value; }
      }
      public string Name {
         get { return name; }
         set { name = value; }
      }

      public string Address {
         get { return address; }
         set { address = value; }
      }
      #endregion


      #region Constructors
      public Server(string name, string address, bool isSource) {
         this.name = name;
         this.address = address;
         this.isSource = isSource;
      }
      public Server() {}
      #endregion
   }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions