Remove lines from a file: Difference between revisions
m
Removed (false) comment
(+Stata) |
m (Removed (false) comment) |
||
Line 655:
=={{header|C sharp}}==
{{works with|C sharp|6}}
<lang csharp>using System;
using System.IO;
Line 660 ⟶ 661:
public class Rosetta
{
public static void Main() => RemoveLines("foobar.txt", start: 1, count: 2);
File.WriteAllLines(filename, File.ReadAllLines(filename)
.Where((line, index) => index < start - 1 || index >= start + count - 1));
}</lang>
|