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

  • Home
  • SEARCH
  • 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 6564199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:56:13+00:00 2026-05-25T13:56:13+00:00

I need to store different objects in IsolatedStorage and i’m using IsolatedStorageSettings class to

  • 0

I need to store different objects in IsolatedStorage and i’m using IsolatedStorageSettings class to do that. Some of that objects are base types so stored and retrieved well. But some of them are custom classes instances and they stored well, but when i try to retrieve them i get instances with the initial values.
How can i store custom classes instances in IsolatedStorage and retrieve them?

Phil Sandler, i guess so. but i don’t know what type of serialization use isolated storage, so i don’t know how to make my class serializable. Private fields also must be stored.
Here is the code of custom class:

public class ExtentHistory : INotifyPropertyChanged
{
    private const int Capacity = 20;
    private List<Envelope> _extents;
    private int _currentPosition;

    public event PropertyChangedEventHandler PropertyChanged;

    public int ItemsCount
    {
        get { return _extents.Count; }
    }

    public bool CanStepBack 
    {
        get { return _currentPosition > 0; }
    }

    public bool CanStepForward 
    {
        get { return _currentPosition < _extents.Count - 1; }
    }

    public Envelope CurrentExtent 
    {
        get { return (_extents.Count > 0) ? _extents[_currentPosition] : null; }
    }

    public ExtentHistory()
    {
        _extents = new List<Envelope>();
        _currentPosition = -1;
    }

    public void Add(Envelope extent)
    {
        if (_extents.Count > Capacity)
        {
            _extents.RemoveAt(0);
            _currentPosition--;
        }

        _currentPosition++;
        while (_extents.Count > _currentPosition)
        {
            _extents.RemoveAt(_currentPosition);
        }
        _extents.Add(extent);
    }

    public void StepBack()
    {
        if (CanStepBack)
        {
            _currentPosition--;
            NotifyPropertyChanged("CurrentExtent");
        }
    }

    public void StepForward()
    {
        if (CanStepForward)
        {
            _currentPosition++;
            NotifyPropertyChanged("CurrentExtent");
        }
    }

    private void NotifyPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

And here are the functions of storing and retrieving:

private IsolatedStorageSettings _storage;

public void Store(string key, object value)
{
    if (!_storage.Contains(key))
    {
        _storage.Add(key, value);
    }
    else
    {
        _storage[key] = value;
    }
}

public object Retrieve(string key)
{
    return _storage.Contains(key) ? _storage[key] : null;
}

I don’t want to serialize manually every object to add, i want to make custom class serializable by default to store it in isolated storage (if it’s possible)

  • 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-25T13:56:13+00:00Added an answer on May 25, 2026 at 1:56 pm

    My inital guess would be a serialization problem. Do all your properties have public setters? Post the classes you are storing and the code you are using to store them.

    I believe IsolatedStorageSettings uses the DataContractSerializer by default. If you want ExtentHistory to be serialized, you should read up on what you need to do to get it to work properly with this serializer:

    DataContractSerializer Class

    You might create a separate object strictly for the purpose of storing the data in Isolated storage (sort of like a DTO). This will allow you to keep ExtentHistory as-is.

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

Sidebar

Related Questions

I need help with pointers and memory management. I need to store different objects,
I have a following problem: I need to store generic objects with different type
I need to create a database table to store different changelog/auditing (when something was
I need to store the summer time (daylight saving time) change-over rules for different
I need to read different values stored in a file one by one. So
I have id values for products that I need store. Right now they are
I need to store some sensitive data by encrypting it with atleast 128 bit
I need to define a class that represents a real-life event -- like a
I need to store a growing large number of objects in a collection. While
I have a base class and 4 derived classes. I store all my derived

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.