I am writing C # .net code that stores some values ββin the registry. It worked fine until I wanted to save some binary data.
I have a List<MyType> object, where MyType looks like this:
[Serializable] public class MyType { public string s {get;set;} public string t {get;set;} }
I get an error with the following code:
List<MyType> objectToSaveInRegistry = getList(); RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(MySpecialKey, true); registryKey.SetValue("MySpecialValueName", objectToSaveInRegistry , RegistryValueKind.Binary);
Error: "The type of the value object does not match the specified ValueKind register or the object cannot be correctly converted."
What can I do to save my object in the registry?
source share