I'm trying to convert a byte array to a string in Silverlight, but I get the following compilation error:
'System.Text.Encoding.GetString(byte[])' is inaccessible due to its protection level
This is the method that I'm using:
string text = UTF8Encoding.UTF8.GetString(myByteArray);
How else can I achieve this?
You can write:
string text = UTF8Encoding.UTF8.GetString(yourByteArray, 0, yourByteArray.Length);
Silverlight 3 and 4 only support that override.
string text = Encoding.UTF8.GetString(myByteArray,0,myByteArray.Length);
Works in SL4, don't know about anything earlier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With