C# C# Streams and Data Processing Reading Data Console I/O

Samuel Joseph
Samuel Joseph
5,406 Points

I am getting the error message on (file.FullName) cannot convert from 'string' to 'System.IO.Stream'

string currentDirectory = Directory.GetCurrentDirectory(); DirectoryInfo directory = new DirectoryInfo(currentDirectory); var fileName = Path.Combine(directory.FullName, "data.txt"); var file = new FileInfo(fileName);

        if (file.Exists)
        {
            using (var reader = new StreamReader(file.FullName))
            {
                Console.SetIn(reader);
                Console.WriteLine(Console.ReadLine());
            }

        }
        Console.ReadLine();

1 Answer

Iskander Ismagilov
Iskander Ismagilov
13,298 Points

Hi, Samuel! If your developing platform is Windows Universal Application, check this article from StackOverFlow.