Answer the question
In order to leave comments, you need to log in
How to convert List element to byte[] array?
First I declare a list :
Then I fill it with data:List<string> K = new List<string>();
K.Add("FirstString");
K.Add("SecondString");
K.Add("ThirdString");
byte[] tmp = K[i].SelectMany(s => Encoding.Default.GetBytes(s)).ToArray();
Answer the question
In order to leave comments, you need to log in
You are calling SelectMany on string. Therefore s is of type char. But GetBytes is expecting a string.
For some reason it seems to me that you wanted to write like this:
byte[] tmp = K.SelectMany(s => Encoding.Default.GetBytes(s)).ToArray();
Or so
byte[] tmp = Encoding.Default.GetBytes(K[i]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question