Not sure if i phrased the title correctly but say i have a method such as:
public static string[] ByteArrayToStringArray(byte[] buffer)
{
//code here
}
would it be better to do
List<string> list = new List<string>();
for (int i = 0; i < buffer.Length; i++)
{
list.Add(buffer[i].ToString());
}
return list.ToArray();
or would it be better to do
List<string> list = new List<string>();
foreach (byte b in buffer)
{
list.Add(b.ToString());
}
return list.ToArray();
which is faster or is there no difference between them?