Load Binary Formatter file in Universal app

浪子不回头ぞ 提交于 2019-12-12 04:00:03

问题


I have an application build with .NET 4.0 and I want to port this application to a Windows 10 application.

In the old application I saved my data to a binary file using Binary Formatter.

using (FileStream fs2 = File.Create(serializationFile))
            {
                var bformatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

                bformatter.Serialize(fs2, transactionData);
            }

With the following class that is serialized:

    [Serializable]
public class TransactionData
{
    public TransactionData()
    {

    }

    public string Name { get; set; }
    public List<TransactionCategory> TransactionCategories { get; set; }
    public List<TransactionMonth> TransactionMonths { get; set; }
}

I would like to load that files in my Universal App.

The problem is the following are not working:

[Serializable]

and:

System.Runtime.Serialization.Formatters

Is it possible to load this files in Universal App? And if so, how can it be done?

来源:https://stackoverflow.com/questions/32976167/load-binary-formatter-file-in-universal-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!