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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:56:24+00:00 2026-05-11T21:56:24+00:00

I am looking for a way to store a key-value pair in the application

  • 0

I am looking for a way to store a key-value pair in the application settings. From what I have found, key-value pair dictionaries are not serializable, and therefore cannot be stored in the application settings.

Currently I have tried all sorts of dictionaries and collections and all of them work, until I restart the application, then all the settings are gone.

Somewhere I read that a ListDictionary is serializable, but I still have not been able to get that to work. If someone could give me some VB.net examples of how to get this to work using the Application Settings, that would be great!

Thanks!

  • 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-11T21:56:24+00:00Added an answer on May 11, 2026 at 9:56 pm

    The Dictionary(Of TKey,TValue) class is actually serializable but in the binary sense. The XmlSerialization engine unfortunately cannot process anything that implements IDictionary and that’s what prevents it from working in application settings.

    What I usually do to work around this is to create a small class that is XmlSerializable and represents a Key/Value pair. I think serialize a collection of those Key / Value pairs. It’s easily convertible back to a Dictionary(Of TKey,TValue) later.

    For example, if the two items were Name and Student

    Public Class Pair
      ' Actual property implementation omited for brevity
      Public Property Student As Student
      Public Property Name As String
    End Class
    

    Then I use the following to convert back and forth between an Array and a Dictionary

    Public Function ToArray(map As Dictionary(Of Name,Student)) As Pair()
      Return map.Select(Function(x) New Pair(x.Key,x.Value).ToArray()
    End Function
    
    Public Function ToMap(arr As Pair()) As Dictionary(Of Name, Student)
      return arr.ToDictionary(Function(x) x.Name, Function(y) y.Student)
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a way to store key-value pairs. I need the lookup
I'm looking for the most efficient way to store key value pairs in a
I'm looking for a way to maintain the sorting on my key-value pairs. They
I am looking for a way to store references to variables inside a NSMutableArray.
I am looking for a neat/clean way to store a list of strings into
I am looking for an appropriate way to store and access pdf files in
I'm looking for an elegant and efficient way to represent and store an arbitrary
I'm looking a way to enable IP logging with log4net in ASP.NET. I found
I'm looking for way to write Javascript programs / scripts on desktop, not inside
We have a requirement to store 500 measurements per second, coming from several devices.

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.