[dba-VB] C# serialization

jwcolby jwcolby at colbyconsulting.com
Tue Oct 13 11:43:39 CDT 2009


I am under the impression that you can write ANY repeating sequence such as these grade classes to 
XML and read them back rather easily, using serialization.  However the only examples I am seeing 
are from back in 100, 2002, 2004.  A lot has happened since then, so I figured to get modern 
examples of the same thing.  Google is not being my friend ATM.

As I said, I did this in VB, but cannot find my old code.

I will certainly end up doing the database thing, but I want to get the basic C# syntax down before 
I go there.  I am still thumbing through my book for the simplest little things.

John W. Colby
www.ColbyConsulting.com


Gustav Brock wrote:
> Hi John
> 
> Oh, I don't regard myself as a master in C# and you will probably learn something that is new to me. However, coming from Access, I went straight ahead for the database (dataset) stuff as I can see people are wasting endless hours writing primitive SqlCommand code as if nothing has happened since classic ASP or VB4.
> 
> For very simple applications you may not need much more than your current task: write your values to an ini .. sorry xml file and read it back at the next launch. For this, no database engine is needed, not even Access/JET, but XML files fit nicely this purpose (and more).
> 
> /gustav
> 
> 
>>>> jwcolby at colbyconsulting.com 13-10-2009 18:13 >>>
>  > Of course, I can see an educational purpose by handcrafting a kind of database, but ...
> 
> LOL.  Well, this is after a CLASS in C# the purpose of which is to LEARN C#.  You do not start at 
> typed data sets, you start with "this is a variable" and "this is a for loop".  I am very much at 
> that level.
> 
> I am quite sure that in a year I will be throwing out typed datasets with the best of them but right 
> now I am still forgetting to put a ; at the end of the line.
> 
> Have patience Master #2.
> 
> John W. Colby
> www.ColbyConsulting.com 
> 
> 
> Gustav Brock wrote:
>> Hi John
>>
>> Sounds like a quite normal database app to me ...
>>
>> If so, all the typed dataset stuff is ready at your hands.
>> To persist (to an XML file without the overhead you claim about) use method WriteXml.
>> To read it at load, use method ReadXml. Can't be simpler.
>>
>> Of course, I can see an educational purpose by handcrafting a kind of database, but ...
>>
>> /gustav




More information about the dba-VB mailing list