Is there a binary serializer in WIN RT?

advertisements

I'm looking for a binary serializer because in my app, the user can discover many items as they want. Imagine that the user has discover more than 100 items (these items was downloaded from internet) and when the app is suspended the app cannot find the last item because does not exist.

In the app happens this because I always load the first 10 items. But in metro principles said, the app needs to restore everything.. so I was thinking using Binary serializer to save this objects rapidly. But I can't find any class which 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 a ObservableCollection. If I use JSON, will there be any problem by the way I have structured my classes?


Microsoft sample code uses 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();
        }