Serializing a Generics Dictionary?

B

Benton

Hi there,

I could serialize a class until I added this member to it:

private Dictionary<string><TableMapper> = new
Dictionary<string><TableMapper>();

The class has the [Serializable()] attribute, but now it won't serialize.

Does any one know of a code sample that shows how can this be done? Any
workarounds?

Best Regards,

-Benton
 
N

Nicholas Paldino [.NET/C# MVP]

Benton,

Are you sure the TableMapper has the serializable attribute? When you
say it won't serialize, what do you mean? Is an exception thrown?

Also, your syntax is wrong, it should be:

private Dictionary<string, TableMapper> myVariable = new Dictionary<string,
TableMapper>();
 

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