0

我正在开发一个应用程序,其中所有功能都是在一个对象上完成的,这个对象是在繁重、耗时的数据处理之后构建的。这种繁重的处理在安装后只需要一次就可以了。我怎样才能在后台保存这个对象,以免在每个应用程序午餐时都构造它?我的意思是我不想在每次用户运行应用程序时都进行这种耗时的数据处理

4

1 回答 1

0

After you've constructed your big object, serialize it to a file in the application's private data storage.

When your application starts, it should try to load the serialized object from the data file. If this fails, then it will need to construct the object again.

You can serialize it any way you want to. You just need to provide a method that can write the object to a stream, and another method that can initialize the object from that stream.

于 2013-02-20T16:38:59.793 回答