Evyatar Evyatar - 1 year ago 128
C# Question

Convert from string array to byte array

I'm using C#.

I have a string array as follow:


I'm trying to convert the string array to byte array as follow

What is the best way to do that?


Answer Source

Try using Linq:

 string source = "1,2,3,4,5";

 byte[] result = source
   .Select(item => byte.Parse(item))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download