Jun 13, 2014 #1 R rkt_167 Junior Member level 1 Joined Aug 9, 2013 Messages 19 Helped 3 Reputation 6 Reaction score 3 Trophy points 3 Activity points 163 hi all, I want to convert byte array in string array as: byte[] data={11,12,13,14}; should be: string[] datastring={"11","12",13","14"}; means I don't want to change the data only data type needs to be changed... Give syntax .. thanks,
hi all, I want to convert byte array in string array as: byte[] data={11,12,13,14}; should be: string[] datastring={"11","12",13","14"}; means I don't want to change the data only data type needs to be changed... Give syntax .. thanks,
Jun 13, 2014 #2 H horace1 Advanced Member level 5 Joined Nov 18, 2008 Messages 2,118 Helped 596 Reputation 1,188 Reaction score 571 Trophy points 1,393 Location Norwich, UK Activity points 13,063 you can use the ToString method to convert an integer value to a string https://msdn.microsoft.com/en-us/li...?cs-save-lang=1&cs-lang=csharp#code-snippet-1
you can use the ToString method to convert an integer value to a string https://msdn.microsoft.com/en-us/li...?cs-save-lang=1&cs-lang=csharp#code-snippet-1
Jun 16, 2014 #3 H horace1 Advanced Member level 5 Joined Nov 18, 2008 Messages 2,118 Helped 596 Reputation 1,188 Reaction score 571 Trophy points 1,393 Location Norwich, UK Activity points 13,063 example using ToString() Code: byte[] data={11,12,13,14}; string[] datastring = new string[data.Length]; for (int i = 0; i < data.Length; i++) { datastring[i] = data[i].ToString(); Console.WriteLine("btye {0} string {1}", data[i], datastring[i]); }
example using ToString() Code: byte[] data={11,12,13,14}; string[] datastring = new string[data.Length]; for (int i = 0; i < data.Length; i++) { datastring[i] = data[i].ToString(); Console.WriteLine("btye {0} string {1}", data[i], datastring[i]); }