Serializing / Deserializing string array problems

G

Guest

Hi,

I know this will sound like a lot of hand waving, and I'll be glad to supply
some sample code if necessary, but I thought something obvious might jump out
at someone without doing so. Anyway, I have a structure that has several
members including an array of strings. I assign the elements of the string
array from the .Text property of several TextBoxes. I then serialize the
structure and write it to a file. However, when I deserialize it back from
the file, all members of the original structure are valid except the strings,
which are all empty. I've set a breakpoint just prior to writing the
serializing the structure and the strings are there. However, when I set a
breakpoint just after serialization, they're not. Suggestions are
appreciated.

Thanks,
Ray
 
N

Nicholas Paldino [.NET/C# MVP]

Ray,

Could you provide some code showing what you are doing? From what you
say, it should work, but obviously, it isn't, so it's impossible to tell
without seeing the relevant code.
 
A

atlaste

Hi,

I know this will sound like a lot of hand waving, and I'll be glad to supply
some sample code if necessary, but I thought something obvious might jump out
at someone without doing so. Anyway, I have a structure that has several
members including an array of strings. I assign the elements of the string
array from the .Text property of several TextBoxes. I then serialize the
structure and write it to a file. However, when I deserialize it back from
the file, all members of the original structure are valid except the strings,
which are all empty. I've set a breakpoint just prior to writing the
serializing the structure and the strings are there. However, when I set a
breakpoint just after serialization, they're not. Suggestions are
appreciated.

Thanks,
Ray

Just wondering, have you marked the thing with a 'serializable()'
attribute?

Cheers,
Stefan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top