public void AppendAllLines()
        {
            // Type
            var @this = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Examples_System_IO_FileInfo_AppendAllLines.txt"));

            // Intialization
            using (FileStream stream = @this.Create())
            {
            }

            // Examples
            @this.AppendAllLines(new[] { "Fizz", "Buzz" });

            // Unit Test
            Assert.AreEqual("Fizz" + Environment.NewLine + "Buzz" + Environment.NewLine, @this.ReadToEnd());
        }
        internal static void EnumerateOperation <T>(this IEnumerable <T> items,
                                                    State state,
                                                    string operationName,
                                                    Func <T, object> getId,
                                                    FileInfo failFile,
                                                    CancellationToken cancellationToken,
                                                    Action <T> action)
        {
            getId = getId ?? (item => item);

            var etaCalculator = new EtaCalculator(5, maximumDuration: TimeSpan.FromMinutes(2).Ticks, state.TotalCount);
            var totalTime     = Stopwatch.StartNew();

            Logger.Info("begin {operationName} for {count} items", operationName, state.TotalCount);

            foreach (var item in items.TakeWhile(i => !state.ShouldQuit && !cancellationToken.IsCancellationRequested))
            {
                var id = getId(item);
                try
                {
                    state.Processed++;
                    etaCalculator.Increment();
                    action(item);
                    Logger.Debug("processed {operationName} for {id}", operationName, id);
                }
                catch (Exception e)
                {
                    state.Errored++;
                    Logger.Error(e, "errored {operationName} for {id}", operationName, id);
                    failFile?.AppendAllLines(id.ToString().ToEnumerable());
                }
                finally
                {
                    if (state.ShouldReport())
                    {
                        if (etaCalculator.TryGetEta(out var etr, out var eta))
                        {
                            Logger.Info(new
                            {
                                state   = new { state.TotalCount, state.Processed, state.Succeeded, state.Errored },
                                elapsed = totalTime.Elapsed,
                                etr, eta
                            });
                        }
                        else
                        {
                            Logger.Info(new
                            {
                                state   = new { state.TotalCount, state.Processed, state.Succeeded, state.Errored },
                                elapsed = totalTime.Elapsed
                            });
                        }
                    }
                }
            }

            Logger.Info(
                state.ShouldQuit ? "quit {operationName}" : "completed {operationName}",
                operationName);
            if (state.Errored == 0)
            {
                failFile = null;
            }

            Logger.Info(new
            {
                state   = new { state.TotalCount, state.Processed, state.Succeeded, state.Errored },
                elapsed = totalTime.Elapsed,
                failFile
            });
        }