Good day, Hashcode.

I am trying to make the Serializable class, out of habit I am writing:

using System.Runtime.Serialization; namespace someNamespace { [Serializable()] public sealed class SomeClass: ISerializable { private readonly long someField; . . . } 

However, under WinPhone7, this does not work, VS happily declares that it does not know what Serializable & ISerializable is. How to fix it? The application is a port with Java (Android), as far as I remember the Java "implements Serializable" is just C # -s ": ISerializable". It can not be that under winPhone there was no such possibility.

    1 answer 1

    The fact is that for Windows Phone you need to use the DataContract attribute instead of the Serializable attribute.

    Some details:

    DataContract

    DataContractSerializer

    • Today I will try. - Olter
    • one
      I hate WP7 - precisely because of such misunderstandings ... - Barmaley
    • It looks like the truth. Only here, in order to check, you have to completely do the porting, hehe: p Well, okay, I accept the answer, it should work. - Olter