Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FileEx
- {
- string path;
- Func<string> current;
- Func<bool> hasNext;
- public FileEx(string path, Func<string> current, Func<bool> hasNext)
- {
- this.path = path;
- this.current = current;
- this.hasNext = hasNext;
- }
- public void WriteAll()
- {
- System.IO.StreamWriter sw = new System.IO.StreamWriter(path);
- try
- {
- var line = current ();
- while (hasNext ())
- {
- sw.WriteLine (line);
- line = current ();
- }
- }
- catch (Exception ex)
- {
- throw;
- }
- finally
- {
- sw.Close ();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment