Q:

How to check wether user input matches contents of a text file

i'm building a application where users can log in, and then the application ckecks wether the input of the user matches the one in a text file
i've tried using a StreamReader class but i just could't figure  it out. and if any of you find this a dumb question, I just started to learn c# and I really appreciate it if anyone can help. Now, the problem is that i want to compare the input of the user, which he/she types, with the contents of a text file. in this case it's my own desktop. how do i do that? and the code already stores the typed username and password to the file. an attempt was made by me in last "if" statement. Thanks :)
private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string username = Username.Text;
            string password = Password.Text;
            using (StreamWriter sw = new StreamWriter("C:\\Users\\omere\\Desktop\\Username.txt"))
            {
                sw.WriteLine(username);
                sw.WriteLine(password);
            }

            if (username != "C:\\Users\\omere\\Desktop\\Username.txt")
            {
                ErrorDisp.Text = "Login failed. Check if you have typed in the correct username and password";
            }

        }

A:

try this
private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string username = Username.Text;
            string password = Password.Text;
            using (StreamWriter sw = new StreamWriter("C:\\Users\\omere\\Desktop\\Username.txt"))
            {
                sw.WriteLine(username);
                sw.WriteLine(password);
            }

           var lines = File.ReadAllLines("C:\\Users\\omere\\Desktop\\Username.txt");

            if (username != lines[0] || password != lines[1]  )
            {
                ErrorDisp.Text = "Login failed. Check if you have typed in the correct username and password";
            }

        }

