Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:45:09+00:00 2026-06-05T11:45:09+00:00

For NetDataContractSerializer msdn states below NetDataContractSerializer can be used only if both the serializing

  • 0

For NetDataContractSerializer msdn states below

“NetDataContractSerializer can be used only if both the serializing and deserializing ends share the same CLR types”.

My undertanding is that, If I serialized file in .net4.0 using NetDataContractSerializer and later I shifted all the code to .net4.5 then file with .net 4.0 will not get deserialized eventhough code is same.

Please correct me if my understanding is wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:45:10+00:00Added an answer on June 5, 2026 at 11:45 am

    It depends on the types. NetDataContractSerializer is based on types full type name, possibly qualified with the assembly full name. For example, this code:

    List<string> list = new List<string>();
    list.Add("joe");
    list.Add("sam");
    
    NetDataContractSerializer ser = new NetDataContractSerializer();
    using (FileStream stream = File.OpenWrite("test.xml"))
    {
        ser.Serialize(stream, list);
    }
    

    compiled using CLR 2 will produce this:

    <ArrayOfstring z:Id="1" z:Type="System.Collections.Generic.List`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" z:Assembly="0" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/"><_items z:Id="2" z:Size="4"><string z:Id="3">joe</string><string z:Id="4">sam</string><string i:nil="true"/><string i:nil="true"/></_items><_size>2</_size><_version>2</_version></ArrayOfstring>
    

    and the same compiled using CLR 4 will produce this:

    <ArrayOfstring z:Id="1" z:Type="System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" z:Assembly="0" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/"><_items z:Id="2" z:Size="4"><string z:Id="3">joe</string><string z:Id="4">sam</string><string i:nil="true"/><string i:nil="true"/></_items><_size>2</_size><_version>2</_version></ArrayOfstring>
    

    As you see, there are not compatible because they include System.String‘s assembly qualified full name. So it will depend on what you do, but chances are good that it will not work as is. I don’t have a 4.5 setup at hand, but you could test it directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using NetDataContractSerializer . After successfully deserializing an object, is there a way to
I am using the NetDataContractSerializer. I can create, add and serialize objects into data
I am using a netdatacontractserializer and a SerializationBinder to create my own runtime types
I have a situation where I'm serializing some .NET objects using NetDataContractSerializer and storing
How can I tell a certain WCF Service to use DataContractSerializer or NetDataContractSerializer? Suppose
I've tried to move WCF to NetDataContractSerializer using the code in this post: http://lunaverse.wordpress.com/2007/05/09/remoting-using-wcf-and-nhibernate
Does anybody know why the NetDataContractSerializer might add nil entries in a serialized collection?
Personally, I think inheritance is a great tool, that, when applied reasonably, can greatly
I have a client-server application, which communicates using WCF, and uses NetDataContractSerializer to serialize
I'm using NetDataContractSerializer to exchange data among applications. I would like the ReadObject method

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.