转换一个字节数组字符串在Silverlight? [英] Convert a Byte Array to String in Silverlight?

查看:152
本文介绍了转换一个字节数组字符串在Silverlight?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个字节数组转换为在Silverlight一个字符串,但我得到以下编译错误:

I'm trying to convert a byte array to a string in Silverlight, but I get the following compilation error:

System.Text.Encoding.GetString(字节[])'不可访问由于其保护级别

'System.Text.Encoding.GetString(byte[])' is inaccessible due to its protection level

这是我使用方法:

string text = UTF8Encoding.UTF8.GetString(myByteArray);



我还能如何做到这一点?

How else can I achieve this?

推荐答案

您可以这样写:

string text = UTF8Encoding.UTF8.GetString(yourByteArray, 0, yourByteArray.Length);



的Silverlight 3和4的仅支持的覆盖。

这篇关于转换一个字节数组字符串在Silverlight?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆