Encoding.ASCII not available in Silverlight is the

2019-02-25 19:07发布

I have the following line of code for a Windows forms application:

return Encoding.ASCII.GetBytes(chars.ToArray());

This line worked fine, but today I was trying my code on the Windows Phone/Silverlight framework and the:

Encoding.ASCII 

Library does not exist there. Is there any (simple) way to do the same thing but with a Silverlight library?

2条回答
家丑人穷心不美
2楼-- · 2019-02-25 19:33

Probably using Encoding.UTF8 will solve your problem, but you can always use the Silverlight Encoding Generator and get any encoding you'd like!

查看更多
戒情不戒烟
3楼-- · 2019-02-25 19:42

Try using Encoding.UTF8 - Silverlight is unicode only.

查看更多
登录 后发表回答