Commands: SetKeyAsync

SetKeyAsync is used to store any object as a configuration item under the specified key.


Task SetKeyAsync<T>(string key, T data);
key string The configuration name
data T The stored object that will be serialized to JSON and saved as a configuration.

Return Value
Task A task that represents the asynchronous set operation


Let's assume that we need to store file descriptions for some files but we don't want to add such information to their metadata. The file description is represented by the FileDescription class:

public class FileDescription
	 /* ... */

We can achieve that simply by setting such an object under the selected key:

await store
	.SetKeyAsync("descriptions/intro.avi", new FileDescription { /* ... */ });