public void ReadFile_With_OpenRead() { using (var stream = _file.OpenRead(_EXAMPLE_FILE_PATH)) using (var reader = _factory.CreateReader(stream)) { var content = reader.ReadToEnd(); Console.WriteLine("[ViaFile.ReadFile_With_OpenRead] File content: " + content); } }
public void ReadFile_With_OpenRead() { IFileInfo fileInfo = _factory.CreateFileInfo(_EXAMPLE_FILE_PATH); using (IFileStream stream = fileInfo.OpenRead()) using (IStreamReader reader = _factory.CreateReader(stream)) { string content = reader.ReadToEnd(); Console.WriteLine("[ViaFileInfo.ReadFile_With_OpenRead] File content: " + content); } }