开发者

C# convert binary data to string?

I was just going through the registry retrieving values and binary is making my file outputer fall.

I was wondering how could I convert Subkey.getValue(value[i]) into a String if the V开发者_开发知识库alue type is binary?


Since the type is binary, the assumption would be that the byte array (which it will be, as Matthew mentioned) isn't going to be of any 'normal' string encoding type (ascii, utf16, etc), so I don't think you're asking to convert it to one of those (if you were, just use Encoding.Foo.ToString)

Since you want it as a string, it then depends on what kind of string you want. If you just want some string and don't care about the particular format, I'd just use the BCL's BitConverter:

http://msdn.microsoft.com/en-us/library/3a733s97.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜