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 709265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:29:05+00:00 2026-05-14T04:29:05+00:00

For each item in my application’s settings, I’ve added text to its Description Property

  • 0

For each item in my application’s settings, I’ve added text to its Description Property which I want to retrieve at runtime. I’m sure I’m missing some basic logical nuance here, but everything I’ve tried has failed. Clearly, my understanding of what value needs to be passed to the Attributes property of the SettingsProperty class is wrong. I’m further confused by the fact that when I iterate through all they keys returned by SettingsProperty.Attributes.Keys, I can see “System.Configuration.SettingsDescriptionAttribute”, but when I pass that string in as the key to the Attributes property, null is returned.

Any insight into how to properly retrieve the value Description Property would be very much appreciated. Thanks. 🙂

public void MyMethod()
    {
        SettingsPropertyCollection MyAppProperties = 
            Properties.Settings.Default.Properties;

        IEnumerator enumerator = MyAppProperties.GetEnumerator();

        // Iterate through all the keys to see what we have....
        while (enumerator.MoveNext())
        {
            SettingsProperty property = (SettingsProperty)enumerator.Current;
            ICollection myKeys = property.Attributes.Keys;

            foreach (object theKey in myKeys)
                System.Diagnostics.Debug.Print(theKey.ToString());
                // One of the keys returned is: 
                   System.Configuration.SettingsDescriptionAttribute
        }

        enumerator.Reset();

        while (enumerator.MoveNext())
        {
            SettingsProperty property = (SettingsProperty)enumerator.Current;

            string propertyValue = property.DefaultValue.ToString();

            // This fails: Null Reference 
            string propertyDescription = 
                property.Attributes["System.Configuration.SettingsDescriptionAttribute"].ToString();

            // Do stuff with strings...
        }
    }
  • 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-05-14T04:29:05+00:00Added an answer on May 14, 2026 at 4:29 am

    The problem is that the key into the Attributes[] indexer does not take a string.

    Try this:

        public void MyMethod()
        {
            SettingsPropertyCollection MyAppProperties =
                Properties.Settings.Default.Properties;
    
            IEnumerator enumerator = MyAppProperties.GetEnumerator();
            object settingsDescriptionAttribute = null;
    
            // Iterate through all the keys to see what we have.... 
            while (enumerator.MoveNext())
            {
                SettingsProperty property = (SettingsProperty)enumerator.Current;
                ICollection myKeys = property.Attributes.Keys;
    
                foreach (object theKey in myKeys)
                {
                    System.Diagnostics.Debug.Print(theKey.ToString());
                    if (theKey.ToString() == "System.Configuration.SettingsDescriptionAttribute")
                        settingsDescriptionAttribute = theKey;
                }
            }
    
            enumerator.Reset();
    
            while (enumerator.MoveNext())
            {
                SettingsProperty property = (SettingsProperty)enumerator.Current;
    
                string propertyValue = property.DefaultValue.ToString();
    
                // This fails: Null Reference  
                string propertyDescription =
                    property.Attributes[settingsDescriptionAttribute].ToString();
    
                // Do stuff with strings... 
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote application which uses ListActivity . Each item of the list consists of
I want to use a CheckedListBox in an application where each item in the
I want to display a QListView where each item is a checkbox with some
I have a list, each item of which has several things in it, including
This is an todolist application that makes each item appear as if on a
I am writing an application to compare each item on listbox1 to all items
I have a WPF application with ListBox that display list of items. Each item
I have a ListView in which each item has a SeekBar. When I update
How would I go about creating a navigation based application that for each item
in my application, there is a listview, and clicking each item of it leads

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.