How can I convert a Char[] (of any length) to a List ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First you need to understand that chars aren’t bytes in .NET. To convert between chars (a textual type) and bytes (a binary type) you need to use an encoding (see System.Text.Encoding).
Encoding will let you convert between string/char[] and byte[]. Once you’ve got a byte array, there are various ways of converting that into a List<byte> – although you may not even need to, as byte[] implements IList<byte>.
See my article on Unicode for more about the text conversion side of things (and links to more articles).