Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7916097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:40:59+00:00 2026-06-03T14:40:59+00:00

I am trying to make use of .NET configuration and understand custom sections, elements

  • 0

I am trying to make use of .NET configuration and understand custom sections, elements etc.

It seems that implementing these custom sections requires explicit declaration of getters and setters, generally resulting in code bloat.

For example here:

http://msdn.microsoft.com/en-us/library/2tw134k3.aspx

Specifically, it seems necessary for us to explicitly return and set things in the get and set methods.

// Create a "remoteOnly" attribute.
[ConfigurationProperty("remoteOnly", DefaultValue = "false", IsRequired = false)]
public Boolean RemoteOnly
{
  get
  { 
    return (Boolean)this["remoteOnly"]; 
  }
  set
  { 
    this["remoteOnly"] = value; 
  }
}

With the following

[ConfigurationProperty("remoteOnly", DefaultValue = "false", IsRequired = false)]
public Boolean RemoteOnly { get; set }

not being equivalent to the above.

Is this really true – do we have to be verbose even with such vanilla properties?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:41:00+00:00Added an answer on June 3, 2026 at 2:41 pm

    Yes, because you’re relying on an external storage mechanism (the base class’s dictionary which ends up populating the config file).

    Also, if you’re worried about this for code bloat, you are worrying about the wrong things. Write it once, never look at it again. You shouldn’t have so much code dealing with custom configuration settings that it will bloat your codebase. A teeny bump maybe, but not bloat. Also, I’d be happy you’re dealing with this now and not before VS2005 – there was a LOT more code you had to write (you had to parse the XML sections manually).

    Finally, if you still hate it that much, you can always use “the last configuration section handler I’ll ever need”:
    https://sites.google.com/site/craigandera/craigs-stuff/clr-workings/the-last-configuration-section-handler-i-ll-ever-need

    It’s been a long time since he wrote that, but it should still work just fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make use of jQueryUI AJAX tabs in my ASP.Net Webforms
In an ASP.NET MVC3 application, I'm trying to use jQuery to make an asynchronous
So I'm trying to make a combobox use a string that has other strings
I am trying to make a control that makes use of the MapPoint 3d
I am trying to make use of DataAdapter, unfortunately stuck with straight ADO.Net, and
I'm trying to make use of Vexflow ( http://vexflow.com/ ) on the Android. However,
I'm trying to make use of parallel processing with the wordnet package for R
I'm writing some error checking and trying to make use of an boolean array
I am in the process of evaluating FindBugs and am trying to make use
I'm trying to make getJSON to use JSONP object, but I can't figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.