I don't have a string. I was just trying how to read in binary data (not
DWORD, not string data) from Registry. C++ is easy. I just noticed that the
debugger in C# tipped it was a System.Byte[]. When I looked to System.Byte
msdn refs, not clear (or maybe I accept I'm brain dead) how to use C# fric'n
syntax to read binary buffer using .NET. Casting? System.Array?
System.Buffer? What do the experts do? That's all. Thanks for effort and
sorry for my lack of patience. It's just that all 'expert' examples at <you
name it web site> show all the DWORD and string examples. Guess they forgot
about binary data in the registry.
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
<"John Hoffman" <news.microsoft.com>> wrote: Figured out you can cast as follows:
System.Byte[] strByte = (System.Byte[]) rksub.GetValue(vs); // This
returns buffer (say 16 byte buffer...) in strByte
What is the C# way to convert contents of strByte into a string? (C++
would be the usual.....)
OR, is there a way to even bypass casting step? Strings, strings,
string.... Thanks for any help!!!
I have to wonder why you've got a string value in a binary entry to
start with. However, if you have, you just need to do the same as any
other byte[] to string conversion - use Encoding.
See http://www.pobox.com/~skeet/csharp/unicode.html
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too