zauberzeug / SimpleStorage

Simple platform independent key/value storage
Other
35 stars 12 forks source link

How to store object? #8

Closed Fate2018 closed 6 years ago

Fate2018 commented 6 years ago

Is this possible to store object? if can, how to use put and get for Object value?

Thank

rodja commented 6 years ago

Have a look at the Documentation:

storage.Put<DateTime>("some timestamp", DateTime.Now);
var value = storage.Get<DateTime>("some timestamp");

The class must have the [Serializable] attribute. For example: https://github.com/perpetual-mobile/SimpleStorage/blob/master/Tests/SerializationTests.cs#L24