Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save an object to a file in Delphi

Tags:

delphi

In Java, one can save a serializable object to a file and load an object from that file. Can we do this in Delphi? If yes, How?

like image 609
rajeemcariazo Avatar asked Sep 20 '10 09:09

rajeemcariazo


2 Answers

If you ask "Can we do this in Delphi?" - the answer is: yes. I guess you want to know, HOW this can be done in Delphi? Well this depends on what do you want to serialize:

If you want to serialize

  • your own data objects, then you could write your own saveTo/loadFrom functions
  • components, then you could use the built-in component streaming system
  • any unknown object, then you need some RTTI techniques and the objects must publish their serializable properties
like image 194
splash Avatar answered Oct 23 '22 13:10

splash


http://blog.dragonsoft.us/2008/04/21/how-to-serialize-delphi-object/
DeHL: http://alex.ciobanu.org/?p=285

like image 35
André Avatar answered Oct 23 '22 15:10

André