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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:00:18+00:00 2026-05-28T01:00:18+00:00

I have recently became familiar with C# application settings, and it seems cool. I

  • 0

I have recently became familiar with C# application settings, and it seems cool.
I was searching for a way to store a list of custom objects, but I couldn’t find a way!
Actually I saw a post to store int[], but it wasn’t helpful for this problem.
I tried to change the config of that solution in order to make it suitable for my problem. the XML config file of that was:

<Setting Name="SomeTestSetting" Type="System.Int32[]" Scope="User">
  <Value Profile="(Default)" />
</Setting>

I tried to address my object as quoted below in the type attribute but it wasn’t helpful since it doesn’t recognizing my object… I tried “type = List” and “type=”tuple[]”
both of these options didn’t help me!

I have a class looks like:

class tuple
    {
        public tuple()
        {
            this.font = new Font ("Microsoft Sans Serif",8);
            this.backgroundcolor_color = Color.White;
            this.foregroundcolor_color = Color.Black;
        }
        public string log { get; set; }
        public Font font { get ; set; }
        public String fontName { get; set; }
        public string foregroundcolor { get; set; }
        public Color foregroundcolor_color { get; set; }
        public string backgroundcolor { get; set; }
        public Color backgroundcolor_color { get; set; }
        public Boolean notification { get; set; }
    }

and I want to store a list in application setting.
So is there any way to achieve this purpose.
Thanks in advance.
Cheers,

  • 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-28T01:00:19+00:00Added an answer on May 28, 2026 at 1:00 am

    You can use BinaryFormatter to serialize list of tuples as byte array and Base64 (as quite efficient way) to store byte array as string.

    First of all change your class to something like that (hint: [SerializableAttribute]):

    [Serializable()]
    public class tuple
    {
        public tuple()
        {
            this.font = new Font("Microsoft Sans Serif", 8);
        //....
    }
    

    Add property in settings named tuples and type of string.

    tuples in Settings

    Then you can use two methods to load and save generic list of tuples (List<tuple>):

    void SaveTuples(List<tuple> tuples)
    {
        using (MemoryStream ms = new MemoryStream())
        {
            BinaryFormatter bf = new BinaryFormatter();
            bf.Serialize(ms, tuples);
            ms.Position = 0;
            byte[] buffer = new byte[(int)ms.Length];
            ms.Read(buffer, 0, buffer.Length);
            Properties.Settings.Default.tuples = Convert.ToBase64String(buffer);
            Properties.Settings.Default.Save();
        }
    }
    
    List<tuple> LoadTuples()
    {
        using (MemoryStream ms = new MemoryStream(Convert.FromBase64String(Properties.Settings.Default.tuples)))
        {
            BinaryFormatter bf = new BinaryFormatter();
            return (List<tuple>)bf.Deserialize(ms);
        }
    }
    

    Example:

    List<tuple> list = new List<tuple>();
    list.Add(new tuple());
    list.Add(new tuple());
    list.Add(new tuple());
    list.Add(new tuple());
    list.Add(new tuple());
    
    // save list
    SaveTuples(list);
    
    // load list
    list = LoadTuples();
    

    I leave null, empty string and exception checking up to you.

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

Sidebar

Related Questions

Recently I became the proud owner of an Android 4.0 tablet and have been
Recently, I have become increasingly familiar with Django. I have a new project that
I've recently become familiar with Reflection , and have been experimenting with it, especially
I recently became quite interested in developing an adobe air application, and just had
We have recently started using Akka in our software, but most of our code
I recently encountered an odd problem with RSACryptoServiceProvider.VerifyHash . I have a web application
I have recently become interested in the field(s) of data mining and machine learning.
I have recently merged together 5 of my stand-alone projects into one project to
I have recently had a linux server compromised from bots uploading .php scripts and
I have recently been working on implementing an ajax based file uploader for my

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.