In general case, the text cannot be "converted" into ASCII, because .NET supports Unicode, and ASCII only supports Unicode characters with code points below 127.
Just forget ASCII
, it's gone; use any of the UTF encodings.
Remember that they are all equivalent, but resulting binary code is different (in memory, Unicode is represented using UTF16LE). And this is not a bit array, but array of bytes. (You never need a bit array anyway). You need to use
to get byte array and
to go back to string again (use resulting char array as the argument of a
Of course, you will need to use one of concrete UTF classes derived from the abstract class
; I would prefer UTF-8 as the most compact, especially if many characters of your text are withing the ASCII repertoire
, which is most typically the case. Also, this UTF is the standard for most application fields.