Click here to Skip to main content
15,907,328 members
Home / Discussions / C#
   

C#

 
AnswerRe: Rounding numbers? Pin
mikone30-Aug-06 3:57
mikone30-Aug-06 3:57 
Questionconverting Matlab code ito C# Pin
signimage30-Aug-06 3:19
signimage30-Aug-06 3:19 
QuestionTrim a part of string away Pin
Support12330-Aug-06 3:14
Support12330-Aug-06 3:14 
AnswerRe: Trim a part of string away Pin
mikone30-Aug-06 3:20
mikone30-Aug-06 3:20 
GeneralRe: Trim a part of string away Pin
Support12330-Aug-06 3:29
Support12330-Aug-06 3:29 
AnswerRe: Trim a part of string away Pin
Dave Kreskowiak30-Aug-06 5:43
mveDave Kreskowiak30-Aug-06 5:43 
QuestionSerialization of a datatable using FileMode.Append Pin
John Baird30-Aug-06 3:13
John Baird30-Aug-06 3:13 
AnswerRe: Serialization of a datatable using FileMode.Append Pin
Robert Rohde30-Aug-06 5:00
Robert Rohde30-Aug-06 5:00 
Hi,

I have also experienced this. The problem lies in the deserialization of the DataTable. Somehow when deserializing a DataTable it somehow reads some more bytes from the next object in the stream thus destroying the next deserialization step. This not only occurs when using several DataTables but also when you just append some other information after a DataTable. One workaround would be to save your tables in different files. The other possibility would be to add some more custom information to the stream:
Saving:
1. Serialize the table into a MemoryStream.
2. Append the length of the MemoryStream (a simple integer should be alright) to your FileStream.
3. Append the contents of the MemoryStream to the FileStream.
Repeat 1-3 for every DataTable.

The resulting file should logically look somehow likes this:
<Length from Table1><Data from Table1><Length from Table2><Data from Table2><Length from Table3><Data from Table3>...

Loading:
1. Open the FileStream.
2. Deserialize an integer giving you the length of the next DataTable.
3. Deserialize the DataTable.
4. Adjust the Position property of the FileStream to match the length you read at point 2.
Repeat 2-4 for every DataTable (or just until the FileStream is empty).

Robert
GeneralRe: Serialization of a datatable using FileMode.Append Pin
John Baird30-Aug-06 9:12
John Baird30-Aug-06 9:12 
Questioncrestal report Pin
TAREQ F ABUZUHRI30-Aug-06 3:09
TAREQ F ABUZUHRI30-Aug-06 3:09 
Questionusing an eventhandler for a serialport Pin
Yustme30-Aug-06 2:52
Yustme30-Aug-06 2:52 
QuestionHow to insert data in a sql database from datagrid column Pin
choopie30-Aug-06 2:41
choopie30-Aug-06 2:41 
AnswerRe: How to insert data in a sql database from datagrid column Pin
mikone30-Aug-06 2:58
mikone30-Aug-06 2:58 
GeneralRe: How to insert data in a sql database from datagrid column Pin
choopie30-Aug-06 3:12
choopie30-Aug-06 3:12 
GeneralRe: How to insert data in a sql database from datagrid column Pin
Tom Wright30-Aug-06 4:18
Tom Wright30-Aug-06 4:18 
QuestionGeneric Classes and Pointer to one of its Typeparameters [modified] Pin
mikone30-Aug-06 2:30
mikone30-Aug-06 2:30 
QuestionHow Microsoft does it? Pin
jayvardhanpatil30-Aug-06 0:36
jayvardhanpatil30-Aug-06 0:36 
QuestionGetting Icon information from which an application is run Pin
Sgg24530-Aug-06 0:10
Sgg24530-Aug-06 0:10 
AnswerRe: Getting Icon information from which an application is run Pin
leppie30-Aug-06 0:59
leppie30-Aug-06 0:59 
QuestionIs it possible to serialise this in C#? [modified] Pin
stevenykl29-Aug-06 23:46
stevenykl29-Aug-06 23:46 
AnswerRe: Is it possible to serialise this in C#? Pin
Andrei Ungureanu29-Aug-06 23:56
Andrei Ungureanu29-Aug-06 23:56 
GeneralRe: Is it possible to serialise this in C#? Pin
stevenykl30-Aug-06 0:11
stevenykl30-Aug-06 0:11 
QuestionRegarting tree view Drag drop Pin
chandler8329-Aug-06 22:32
chandler8329-Aug-06 22:32 
QuestionDrawing Pin
Vsree29-Aug-06 22:03
Vsree29-Aug-06 22:03 
AnswerRe: Drawing Pin
Andrei Ungureanu29-Aug-06 23:39
Andrei Ungureanu29-Aug-06 23:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.