Encoding.ASCII not available in Silverlight is there a alternative?

梦想与她 提交于 2019-12-20 03:17:15

问题


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?


回答1:


Try using Encoding.UTF8 - Silverlight is unicode only.




回答2:


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



来源:https://stackoverflow.com/questions/10010840/encoding-ascii-not-available-in-silverlight-is-there-a-alternative

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!