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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:33:18+00:00 2026-05-22T23:33:18+00:00

Just now I came across ApplicationSettings in .NET WinForms that could handle complex types.

  • 0

Just now I came across ApplicationSettings in .NET WinForms that could handle complex types.
Currently I am using AppSettings in my ASP.NET WebForms which can handle only string.
Can I use ApplicationSettings in Webforms? If so how?

  • 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-22T23:33:19+00:00Added an answer on May 22, 2026 at 11:33 pm

    The basic idea:

    1. In a different project, create classes that will hold your custom settings. For example:

      public class EndPoint
      {
          public string HostName { get; set; }
          public int Port { get; set; }
      }
      
      public class EndPointCollection : Collection<EndPoint>
      {
      }
      
    2. Build the project containing the classes.

    3. Go to the Settings tab in Project Properties. It will say that there is no settings file yet and ask if you want to create it.

    4. Add a new settings file. In the type field select Browse and type the full class name. For example: ClassLibrary.EndPointCollection. Save and rebuild the project.

    5. Hit the edit button for the setting value. (Note that this will not be available if the classes made in the earlier step are in the same project.) Use the UI to edit the settings.

      Visual Studio's settings value editor

    6. If you open the web.config / app.config file, you will see something like this:

      ...
      <applicationSettings>
        <WebApplication1.Properties.Settings>
          <setting name="MyEndPoints"
                   serializeAs="Xml">
            <value>
              <ArrayOfEndPoint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                <EndPoint>
                  <HostName>MyHostName</HostName>
                  <Port>12345</Port>
                </EndPoint>
                <EndPoint>
                  <HostName>MyHost1</HostName>
                  <Port>1212</Port>
                </EndPoint>
              </ArrayOfEndPoint>
            </value>
          </setting>
        </WebApplication1.Properties.Settings>
      </applicationSettings>
      ...
      
    7. Finally, to read these settings from your code, simply use

      var endPointCollection = Settings.Default.MyEndPoints;
      

      The designer will have created, behind the scenes, the strongly-typed objects to allow the above to work. You can see the full details in the Settings.Designer.cs file.

    Bottom line: you can make all kinds of custom type settings, as long as those settings have XmlSerializable or have type converter. This technique works on Web Applications, WinForms, WPF, Console Applications etc.

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

Sidebar

Related Questions

I just came across Google Native Client Now, it looks really interesting that they
I just came across this weird problem that is happening in IE. In the
So I'm just learning C#, and came across something that I find odd... I'm
I just came across this post that talks about time measuring. I remember (I
I just came across the Hole in the Middle pattern and think that I
HI, I just came across good link and used that in my code.. how
Working in Delphi7 just now, I noticed that not only a VarIsEmpty function exists,
I've done some Python but have just now starting to use Ruby I could
Here is something that I have came across in Scala that did not cause
I just came across a VFS and a filesystem in userspace like FUSE .

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.