System.IO.File.AppendAllLines C# (CSharp) Méthode

AppendAllLines() public static méthode

public static AppendAllLines ( String path, IEnumerable contents ) : void
path String
contents IEnumerable
Résultat void
        public static void AppendAllLines(String path, IEnumerable<String> contents)
        {
            if (path == null)
                throw new ArgumentNullException(nameof(path));
            if (contents == null)
                throw new ArgumentNullException(nameof(contents));
            if (path.Length == 0)
                throw new ArgumentException(SR.Argument_EmptyPath, nameof(path));
            Contract.EndContractBlock();

            InternalWriteAllLines(new StreamWriter(path, append: true), contents);
        }

Same methods

File::AppendAllLines ( String path, IEnumerable contents, Encoding encoding ) : void
File::AppendAllLines ( string path, System contents ) : void
File::AppendAllLines ( string path, System contents, System encoding ) : void

Usage Example

Exemple #1
0
        public void NotifySuiteFinalized(string name, bool passed, int runtime)
        {
            Response.ContentType = "text/plain";
            lock (IO_SYNC)
            {
                if (passed && _runFlags.IsContinuousIntegration)
                {
                    IOFile.AppendAllLines(_completedSuitesFileName, new[] { name });
                }
                ConsoleHelper.Write("[");
                if (passed)
                {
                    ConsoleHelper.Write(" OK ", ConsoleColor.Green);
                }
                else
                {
                    ConsoleHelper.Write("FAIL", ConsoleColor.Red);
                }

                TimeSpan runSpan = TimeSpan.FromMilliseconds(runtime);
                ConsoleHelper.WriteLine($"] {name} in {Math.Round(runSpan.TotalSeconds, 3)}s");

                NotifyIsAlive();
            }
        }
All Usage Examples Of System.IO.File::AppendAllLines