Serialization into a text file

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hello everybody,

I have a console app which runs some queries on a database and writes
the results into an excel file.

I'd like to build a GUI which would allow to give some parameters to
the console app, for example to forbid the execution of a query.

All queries are grouped into several modules.

I have thought to create a bunch of classes I would serialize, pass
the serialized string to the console app, which would then deserialize
it and set the options to execute a module or not, or a query, or
whatever...

The fact is that I have found documentation about only the
binaryformatter, but I got some errors passing it to the console.

Is there any way to serialize my classes into a text stream, so that
would work?

Or are there any other solutions to my problem?

Thanks in advance

Mike
 
You need to look harder. Google ".NET Serialization", ".NET XML
Serialization", ".NET binaryformatter", etc... Theres plenty of info on it.

Except that I don't want to serialize in XML or in a binary format,
and I couldn't find some infos on how to serialize into a
"normal" (think non-binary) format...
 
Michael said:
Hello everybody,

I have a console app which runs some queries on a database and writes
the results into an excel file.

I'd like to build a GUI which would allow to give some parameters to
the console app, for example to forbid the execution of a query.

All queries are grouped into several modules.

I have thought to create a bunch of classes I would serialize, pass
the serialized string to the console app, which would then deserialize
it and set the options to execute a module or not, or a query, or
whatever...

The fact is that I have found documentation about only the
binaryformatter, but I got some errors passing it to the console.

Is there any way to serialize my classes into a text stream, so that
would work?

You need to look harder. Google ".NET Serialization", ".NET XML
Serialization", ".NET binaryformatter", etc... Theres plenty of info on it.
 
You can write your own serializier/deserializer if you choose, which can go
from text file to object and vice versa.
This is alot of drama.

I think you would be wiser to just piggy back on the built in xml
serialization.
An xml file is a text file, just a text file with a specific formatting.
Xml is a string as well.


Here is some sample code
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!114.entry
even though its more 1.1 based, it'll open the door.
Pay attention to the SerializationHelper for you string needs.
 
The serialization framework is built into .NET, and it is standardized for a
reason. You have (basically) 3 choices:
1. Binary (BinaryFormatter)
2. XML (XmlSerializer)
3. Roll your own
-- Obviously, if you don't want to use Binary or XML, you should probably
have a good reason why - because you are now faced with the last choice.

--Peter
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net
 
The serialization framework is built into .NET, and it is standardized for a
reason. You have (basically) 3 choices:
1. Binary (BinaryFormatter)
2. XML (XmlSerializer)
3. Roll your own
-- Obviously, if you don't want to use Binary or XML, you should probably
have a good reason why - because you are now faced with the last choice.

OK, do you have links about how to roll my own?
 
Back
Top