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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:56:27+00:00 2026-05-10T23:56:27+00:00

What is the best way to store instances of a class to file/database? We

  • 0

What is the best way to store instances of a class to file/database?

We have a base class called Command and loads of derived classes. Users create instances of these classes by adding commands to a graphical designer where they can configure them. (Set the properties).

We then need a way to store these ‘commands’ to a file without losing any information.

One idea was to use db4o, but the GPL license is not acceptable for this project.

Any suggestions or code samples?

Update:

(In order to ‘de-blurryfie’ my question :p)

The generated code might look something like:

    command[i++] = new DelayInSecondsCommand(2);     command[i++] = new DaliRequestCommand(1, false, 254);     command[i++] = new DaliRequestCommand(2, false, 254);     command[i++] = new DaliRequestCommand(3, false, 254);     command[i++] = new WaitInSecondsCommand(2);                  command[i++] = new DaliRequestCommand(1, false, 0);     command[i++] = new DaliRequestCommand(2, false, 0);     command[i++] = new DaliRequestCommand(3, false, 0);     command[i++] = new JumpCommand(0); 

But then with loads of different commands.

I know it’s possible with .NET serialization, altough I’ve never used it before, but I was wondering if there are better alternatives, like I said db4o seems nice but the license doesn’t fit the project.

Update 2:

Thank you for the replies. I’ll probably go with the serialization solution now, but I’ll look into the other options as well. F.Y.I. data is stored in a SQL Compact database.

  • 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. 2026-05-10T23:56:28+00:00Added an answer on May 10, 2026 at 11:56 pm

    serialization does the trick! Serialization is nothing more than converting an object or a connected graph of objects into a stream of bytes (in order to persist the current state of the object). This can be a binary stream, XML or whatever. You don’t have to do this conversion by your own since .Net has great support for serialization. Once you serialized an object, you are free to store this data to a file or database. Likewise, a stream of bytes representing a serialized object can be deserialized into an object which will have the same state as the original one.

    Btw: Once you have a serialized stream of bytes, you can apply some more functions on it, e.g. compression or encryption.

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

Sidebar

Ask A Question

Stats

  • Questions 74k
  • Answers 74k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Most likely, the functions return a static string, so it… May 11, 2026 at 2:24 pm
  • added an answer You shouldn't throw any exception that is automatically thrown by… May 11, 2026 at 2:24 pm
  • added an answer You can catch this using the set_error_handler function: function handle_errors(… May 11, 2026 at 2:23 pm

Related Questions

I would like to know, what would be the best way to manage a
My ASP.NET application needs a number of supporting services to run periodically in the
Okay this is a fairly broad question. This is my first App and I'm
I have been struggling with the best way to make sure that the certain

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.