FileExtensions.

ReadLines(IFile, Encoding) Method

Summary

Enumerates line in file.
Namespace
Cake.Core.IO
Containing Type
FileExtensions

Syntax

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times")]
public static IEnumerable<string> ReadLines(this IFile file, Encoding encoding)

Examples

var file = context.FileSystem.GetFile("./README.md");
foreach (var line in file.ReadLines(System.Text.Encoding.UTF8))
{
    Information(line);
}

Attributes

Type Description
SuppressMessageAttribute

Parameters

Name Type Description
file IFile The file to be read from.
encoding Encoding The encoding that is applied to the content of the file.

Return Value

Type Description
IEnumerable<string> A IEnumerable<T> of file line content.