Bart Teunissen
Bart Teunissen

Reputation: 1470

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

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?

Upvotes: 2

Views: 2756

Answers (2)

Pedro Lamas
Pedro Lamas

Reputation: 7243

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

Upvotes: 0

Chriseyre2000
Chriseyre2000

Reputation: 2053

Try using Encoding.UTF8 - Silverlight is unicode only.

Upvotes: 5

Related Questions