Results 1 to 3 of 3

Thread: [2005] Save Class to Application Settings

  1. #1

    Thread Starter
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    [2005] Save Class to Application Settings

    This might be a dumb question but I was just curious if it was possible to save a class that inherits from the CollectionBase class to the application settings.

    For example I have an AccountsCollection that inherits CollectionBase and holds account information an is used throughout the system and if a user changes or updates the account. I want to be able to save this information and reload it when app starts again later.

    Thanks In Advance.

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] Save Class to Application Settings

    I'm not 100% percent sure but I think you'd have to add metadata to the class definition to handle serialisation. When an object is saved to the config file through application settings it is serialised. If the system doesn't know how to serialise your class then it won't be able to save it. Like I said, I don't know for sure because I've never tried but that sounds logical to me (unlike most of what I say ). I'm sure MSDN has information about saving custom types to the config file.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Re: [2005] Save Class to Application Settings

    Darn Internet went out for a long time. Thanks I will take a look into that.

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width