static void Main(string[] args) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); var configuration = builder.Build(); var filePath = configuration.GetSection("FilePath").Value; var readStream = new ReadStream(filePath); do { Read(readStream, out var result); Console.WriteLine(result); } while (!readStream.EndOfStream()); Console.ReadLine(); }
public static void Read(ReadStream readStream, out string val) { val = readStream.ReadLine(); }