case sensitive hashtable corss framework serialization

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi there,
has anyone had success in serializing a 2.0 case sensivite hashtable
ie.
private Hashtable m_itemsById = new Hashtable(
new CaseInsensitiveHashCodeProvider(),
new CaseInsensitiveComparer());

And deserializing it in 1.1?

It doens't work, and a serialization exception is thrown indication that
System.Globalization.TextInfo has 5 members (2.0) where only 3 are expected
(1.1)

Anyone got a solution to the problem above?

thanks in advance
Brian
 
Brian,

You aren't really going to be able to do that. Instead of serializing
the hashtable, why not create a type that stores keys and values, and create
a new hash table when you try and de-serialize the object?

Hope this helps.
 
HI Nic,

I considered this option however serialization occurrs alot so maybe not so
good an option.
Another option i considered was implementing my own CaseInsensiviteHashCode
provider and CaseInsensiviteComparer but need to look more into it to see
what's involved.

There is a good chance our server will be ported to beta 2.0 when released
so maybe i'll just ignore the problem for time being and use the "New
Recommendations for Using Strings in Microsoft .NET 2.0".

thanks for your time
brian

Nicholas Paldino said:
Brian,

You aren't really going to be able to do that. Instead of serializing
the hashtable, why not create a type that stores keys and values, and create
a new hash table when you try and de-serialize the object?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Brian Keating said:
hi there,
has anyone had success in serializing a 2.0 case sensivite hashtable
ie.
private Hashtable m_itemsById = new Hashtable(
new CaseInsensitiveHashCodeProvider(),
new CaseInsensitiveComparer());

And deserializing it in 1.1?

It doens't work, and a serialization exception is thrown indication that
System.Globalization.TextInfo has 5 members (2.0) where only 3 are
expected
(1.1)

Anyone got a solution to the problem above?

thanks in advance
Brian
 
Back
Top