Click here to Skip to main content
15,888,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
P_3_J_V1_Data test = new P_3_J_V1_Data();
            test._sSymbol = "XYZ";
            test.IsBreak_UpSide = true;

            P_3_J_V1_Data test_2 = new P_3_J_V1_Data();
            test_2.Child = test;
            test._sSymbol = "RPM";
            test.IsBreak_UpSide = false ;


Now I want to save test_2 whole class into file and then again, want to load any other computer with file. And on loading like symbol, child etc. data will be the same.

What I have tried:

Totally means I want to save runtime whole class into file and I want to load whole class from file runtime.
Posted
Updated 28-Aug-23 10:24am
v3
Comments
Dave Kreskowiak 24-Aug-23 10:00am    
What you're talking about is called "serialization". You're saving the data in the properties of a class instance, not "the whole class".

1 solution

I'd suggest you use JSON: I use Json.NET - Newtonsoft[^] and it's a single line of code to serialize or deserialize a class instance. You can trhen save / load that to / from a file as and when you need to.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900