After asking my question on Code Review.stackexchange I got advised to use the following code pieces. And I noticed that during the transfer the string[] Lines gets set over to a IEnumerable.
After looking around the IEnumerable function for a bit I did not find anything that suggested any performance improvement. So Is this just for readability? Or is there actually a performance difference or general advantage using the IEnumerable instead of an array?
private void ProcessSingleItem(String fileName, String oldId, String newId)
{
string[] lines = File.ReadAllLines(fileName);
File.WriteAllText(fileName, ProcessLines(lines, oldId, newId));
}
private String ProcessLines(IEnumerable<String> lines, String oldId, String newId)
{
StringBuilder sb = new StringBuilder(2048);
foreach (String line in lines)
{
sb.AppendLine(line.Replace(oldId, newId));
}
return sb.ToString();
}