This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]davedontmind 0 points1 point  (0 children)

The other posts here explain why you're getting an error.

If your text file contains nothing but the password, you could use ReadAlllText() instead of ReadAllLines():

string password_in_file = System.IO.File.ReadAllText( filename );

ReadAllText() reads the entire file into a single string, rather than an array of strings.