Thanks, I did that!
IFormatter formatter = new BinaryFormatter();
// ?????? ??? ???????????? ? ??????
byte[] mas = new byte[1024];
Stream stream = new MemoryStream(mas);
formatter.Serialize(stream, obj);
long i = stream.Position;
stream.Close();
byte[] mas2 = new Byte[i];
// ????????? ???????? ?????? ?? mas ? mas2
for(int j = 0; j < i; j++)
{
mas2[j] = mas[j];
}
and there is a next problem.
how to calulate an accurate size of needed array (mas) ?
CurrentKey.SetValue(Name, mas2);
"Jon Skeet" <sk***@pobox.com> ???????/???????? ? ???????? ?????????:
news:MP************************@news.microsoft.com ...
Dmitry <ka******@narod.ru> wrote: Does anybody know how to write binary data to registry?
The purpose is to store an boxed object into registry and to
restore it.
I believe you can use RegistryKey.SetValue, passing in a byte array
containing the appropriate data.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too