开发者

how to save class object in registry?

Basically I have some class objects, each with three properties. On开发者_StackOverflowce one class object is selected in the ComboBox, the corresponding properties shows on three textboxs. I am trying to add one save button. I can change the value of the properties. Once the save button is clicked, all the class ojects with three corresponding properties are saved in the registry. Save setting for later use

It seems Registing tryKey.SetValue Method can not save an object directly?


You'll have to serialize it - either to a byte array or to a string, probably - and then save that data. Then to load the object again, you'll need to fetch the data back from the registry and deserialize it.

There are lots of options for serialization, including:

  • Built-in .NET binary serialization
  • Built-in .NET XML serialization
  • JSON
  • Google Protocol Buffers
  • Thrift

Which one is right for you will depend on your exact requirements.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜