Is there a binary serializer in WIN RT?

I am looking for a binary serializer because in my application the user can detect many elements as they wish. Imagine that a user has discovered more than 100 items (these items have been downloaded from the Internet), and when the application is paused, the application cannot find the last item because it does not exist.

This happens in the application because I always load the first 10 elements. But in principle, the metro said that the application should restore everything .. so I thought to use the Binary serializer to quickly save these objects. But I can not find a class that can help me.

EDIT:

public abstract class BaseItem
{
    ...

    public BaseGroup Group { get; set;}
}

public abstract class BaseGroup
{
    public IEnumerable<BaseItem> Items { get; set; }
}

public sealed class FeedDataGroup
{
    ...
}

public sealed class FeedItem
{
    ...
}

I plan to serialize an ObservableCollection. If I use JSON, will there be any problem how I structured my classes?

+5
4

Microsoft DataContractSerializer

        // Serialize the session state synchronously to avoid asynchronous access to shared
        // state
        MemoryStream sessionData = new MemoryStream();
        DataContractSerializer serializer = new DataContractSerializer(typeof(Dictionary<string, object>), _knownTypes);
        serializer.WriteObject(sessionData, _sessionState);

        // Get an output stream for the SessionState file and write the state asynchronously
        StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(sessionStateFilename, CreationCollisionOption.ReplaceExisting);
        using (Stream fileStream = await file.OpenStreamForWriteAsync())
        {
            sessionData.Seek(0, SeekOrigin.Begin);
            await sessionData.CopyToAsync(fileStream);
            await fileStream.FlushAsync();
        }
+6

BinaryFormatter System.Runtime.Serialization, , . WinRT, .Net 4.5, , .a >

: "" .Net 4.5 ( ), , . Runtime.Serialization .Net 4.5 Core. 4.5 , , BinaryFormatter .

+2

Json System.Runtime.Serialization.Json, JSON, , . , , datacontract

[DataContract]
public class Serializable
{
   [DataMember]
   Public string SerializableMember{get;set;}

   Public string NonSerializedMember{get;set;}
}

DataContractJsonSerializer JSON. JSON : { "SerializableMember": { }} , - json-. JSON , xml, . , Microsoft Metro, ARM , Endian, .

0
0

All Articles