foreach (string file in files) { File.WriteAllLines(file.Replace("_template.cs", ".cs"), File.ReadAllLines(file) .Select(line => string.Format("{0}", line.Replace("$WCREV$", "0")))); }