How do I convert a string
to a byte[]
in .NET (C#)?
Also, why should encoding be taken into consideration? Can't I simply get what bytes the string has been stored in? Why is there a dependency on character encodings?
|
OP's question: "How do I convert a You can use the following code:
As a benefit, encoding does not matter! Oh wait, this is an ecoding... it's just trivial and highly lossy. |
|||
|
Thank you for your interest in this question.
Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?