oclipa
oclipa

Reputation: 382

How to deserialize a binary-serialized NameValueCollection in .NET Core?

We have an existing SQL Server database with a field that contains binary-serialized instances of NameValueCollection. The serialization was done using C# code based on .NET Framework (where NameValueCollection was marked as [Serializable]).

Our code has now been ported to .NET 5, where NameValueCollection is no longer marked as [Serializable]. This means that we cannot deserialize the data written using the old code-base.

Type 'System.Collections.Specialized.NameValueCollection' in Assembly 'System.Collections.Specialized, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.

Is there anyway, in .NET 5 (or .NET 6), to read the NameValueCollections from the database?

Obviously we could write a converter in .NET Framework that would change the binary-serialized data to JSON-serialized, however we would like to avoid this if at all possible (for reasons).

Any ideas?

Upvotes: 1

Views: 181

Answers (0)

Related Questions