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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:31:34+00:00 2026-05-25T01:31:34+00:00

I have the following method to serialize a list of classes to disk: private

  • 0

I have the following method to serialize a list of classes to disk:

private static void Serialize(List<CcmAlarmUalUsl> entityList)
{
    try
    {
        using (Stream stream = File.Open("CcmAlarmUalUsl.dat", FileMode.Create))
        {
            BinaryFormatter bin = new BinaryFormatter();
            bin.Serialize(stream, entityList);
        }
    }
    catch (IOException)
    {
    }
}

The entity class I want to serialize looks like this:

public class CcmAlarmUalUsl
{
    public string SubId { get; set; }

    public System.DateTime TimeOfAlarm { get; set; }

    public int AlarmType { get; set; }
}

Is my Serialize class the best way to serialize the list of entities to disk? This does not need to be human readable. It is to be used strictly by the application, as a storage means for an internal cache. No database storage is necessary.

I’m also a bit concerned about when it comes time to modify the structure of CcmAlarmUalUsl. I could be adding properties to the end of the class. How will this affect existing cached items?

  • 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-25T01:31:35+00:00Added an answer on May 25, 2026 at 1:31 am

    Simple answer – no. Your code won’t compile (lizards1??) and your CcmAlarmUalUs1 class isn’t marked as serializable (run-time error). Mark your CcmAlarmUrlUs1 class as serializable, change lizards1 to entityList and it should work and it looks like you’re doing things fine.

    You’re question is kind of vague, though. By ‘best’, what are you looking for? Without knowing that, it’s hard to really give a good answer.

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

Sidebar

Related Questions

I have following method which I am using to load ActiveX control dynamically, Dim
I have the following method that returns void and I need to use it
I have the following method: public static T ExecuteScalar<T>( string query, SqlConnection connection, params
I have the following code to serialize /deserialize a DataTable: public static byte[] Serialize(DataTable
first things first. I have the following classes: class Employee { private int employeeID;
I have a service that attempting to serialize a list into JSON (using JSON.NET)
I have the following method that I use to serialize various objects to XML.
I have the following Code and web method: public class RaumklassenHelper { internal static
I have the following serialization method: Private Function SerializeData(ByVal data As cData) As String
I have the following method which serialises an object to a HTML tag. I

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.