> i want to serialize a string into a file in net 2.0. i also want to
serialzie
a datatable into a file. Can anyone guide me in this regard.
No serialization is needed when saving strings to files. Strings are written
as they are, so what you need to do is create or open file, obtain
FileStream, wrap it with StreamWriter and write your string to file.
Refer to link [1] below for examples.
I am not familliar with DataTable in .NET 2.0, but in .NET 1.1, it is marked
as Serializable, so all you need to serialize it to any stream (including
FileStream when writing to file) is to instantiate BinaryFormatter and call
method Serialize with your Stream and DataTable you need to serialize.
Refer to [2] for examples.
[1]
http://msdn.microsoft.com/library/de...ClassTopic.asp
[2]
http://msdn.microsoft.com/library/de...classtopic.asp