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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:01:15+00:00 2026-05-23T18:01:15+00:00

Just a quick question. In WP7, is it really bad design/idea to store complex

  • 0

Just a quick question. In WP7, is it really bad design/idea to store complex data using IsolatedStorageSettings.ApplicationSettings? I want to save a collection of some class objects. The properties are marked with [DataMember] attributes.

An example of a class would be,

[DataContract]
public class OfflineItem
{
    [DataMember]
    public string Id { get; set; }
    [DataMember]
    public MyItem Item { get; set; }       
    [DataMember]
    public Dictionary<string, string> KeyValues { get; set; }        
}
Collection<OfflineItems> offlineItems = new Collection<OfflineItems>();
.....
IsolatedStorageSettings.ApplicationSettings["AllOfflineItems"] = offlineItems;

I tried it and it worked, but I want to know if it is a correct approach and will there be any performance hit in the long run?

  • 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-23T18:01:16+00:00Added an answer on May 23, 2026 at 6:01 pm

    @Jonna. I deliberated over this one too. I ended up using/adapating the following generic methods to serialize and deserialize using a IsolatedStorageFile as below. It includes deleting a file if it already exists as you are trying to update the data.

        internal static void Write<T>(T obj, string fileName)
        {
            XmlWriterSettings writerSettings = new XmlWriterSettings
            {
                Indent = true,
                IndentChars = "\t"
            };
    
            try
            {
                using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    if (isoStore.FileExists(fileName))
                    {
                        isoStore.DeleteFile(fileName);
                    }
                    using (var isoStream = new IsolatedStorageFileStream(fileName, FileMode.Create, isoStore))
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(T));
    
                        using (XmlWriter xmlWriter = XmlWriter.Create(isoStream, writerSettings))
                        {
                            serializer.Serialize(xmlWriter, obj);
                        }
                    }
                }
            }
            catch (IsolatedStorageException ex)
            {
                Debug.WriteLine(ex.Message);
            }
            catch (Exception emAll)
            {
                Debug.WriteLine(emAll.Message);
            }
        }
    
        internal static T Read<T>(string fileName)
        {
            try
            {
                using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    using (var isoStream = new IsolatedStorageFileStream(fileName, FileMode.Open, isoStore))
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(T));
                        return (T)serializer.Deserialize(isoStream);
                    }
                }
            }
            catch (IsolatedStorageException ex)
            {
                Debug.WriteLine(ex.Message);
                throw;
            }
            catch (Exception emAll)
            {
                Debug.WriteLine(emAll.Message);
                throw;
            }
        } 
    

    Serialization would be called thus:

    Serialization.Write<user>(userDetails, App.USERDETAILS);
    

    And deserialization would be called thus:

    Items = Serialization.Read<measurements>(App.MEASUREMENTS);
    

    user is a class and userDetails is an object based on the that class. Measurements is a class and Items is an object based on that class. App.USERDETAILS & App.MEASUREMENTS are global strings that contain file names.

    Some debug lines have been left in just so progress can be tracked.

    It might also be worth considering using SQL + LINQ if you are thinking of migrating to Mango and much of this could be taken care of there…

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

Sidebar

Related Questions

Just a quick question. Is there any performance difference between using PDO::fetchAll() and PDO::fetch()
Just a quick question on drawing quads. I'm currently using: GraphicsDevice.DrawPrimitives(PrimitiveType primitiveType, int startVertex,
Just a quick question (hopefully). I want to slide one div in front of
Hey just a quick question for anyone who has done this. I want to
Just a quick question: I want to use an EnumMap in one of my
Just a quick question.. Out of two options mentioned below, how to store to
Just a quick question. If I learn how to develop apps for IPhone using
Just a quick question really. I am re-writing a site and I am converting
I had a quick question on working with listboxes in WP7 using MVVM Light.
Just a quick question, I'm getting the idea that you don't. Why is this,

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.