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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:40:35+00:00 2026-06-11T17:40:35+00:00

Previously, to save the settings of some applications, I used: A TSettings = class(TPersistent)

  • 0

Previously, to save the settings of some applications, I used:

  • A TSettings = class(TPersistent) for the container
  • Each data to serialize in a published property
  • List of object were TCollection and TCollectionItem types
  • The TJvAppXMLFileStorage component to save everything with the single line :

    JvAppXMLFileStorage.WritePersistent(…);

BUT now, I’m using TObjectList as properties in the TSettings class.
So I drop the TCollection/TCollectionItem in favor of Generics …
When serializing it, there is no list of items … I think it’s because TObjectList is not from TPersistent.

How can I serialize my TObjectList<> with TJvAppXMLFileStorage ?

  • 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-06-11T17:40:36+00:00Added an answer on June 11, 2026 at 5:40 pm

    I’ve successfuly serialize my generic list with few lines of code by calling JvAppXMLFileStorage.WriteList.

    First, this is how I serialized the list. The WriteGenericsObjectListItem<TMyClass> method is detailed below.

    JvAppXMLFileStorage.WriteList('mylist',TObject(MyGenericList), MyGenericList.Count, WriteGenericsObjectListItem<TMyClass>);
    

    Then, I just need to define how to serialize each item of the generic list. For this, I’ve created a generic method:

    procedure TMySerializer.WriteGenericsObjectListItem<T>(Sender: TJvCustomAppStorage;
      const Path: string; const List: TObject; const Index: Integer; const ItemName: string);
    begin
      if(List is TObjectList<T>) then
        if Assigned(TObjectList<T>(List)[Index]) then
          Sender.WritePersistent(Sender.ConcatPaths([Path, Sender.ItemNameIndexPath (ItemName, Index)]), TPersistent(TObjectList<T>(List)[Index]));
    end;
    

    That’s it!
    I haven’t modify JCL/JVCL code, only add these to my program.
    I think I will submit a patch to JCL/JVCL team to add the compatibility with all Generics containers.

    I hope this can help you !

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

Sidebar

Related Questions

Previously, I have an app that uses core data. I use same store url
If I want to save any changes in a table, previously saved in SQL
I've got a date property for a model called 'transaction', when I save it
I need to save data in distinct TabItem every time when user switches to
I was previously getting the next available autonumber used in Access by doing a
A previous programmer preferred to generate large lookup tables (arrays of constants) to save
This question is related to the previous post. How to save file and read
Previously, I have worked on local notifications, but I got problem in it now.
Previously, I had my LegNo enums defined simply as: NO_LEG, LEG_ONE, LEG_TWO and by
Previously I have been investigating several solutions how to register with email address instead

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.