The situation is this: I have a file, there are lines in it. I'm trying to find a string by its content and delete it. But the problem is that I can not find on the Internet how to remove it.
That is, the work of this method should be as follows:
The user enters a login, and the file is searched for, if it finds one, then it must delete this line.
The file itself:
lol:9cdfb439c7876e703e307864c9167a15 you:91c366db3df8b21eeb76be5c250f1a40 kek:4cfdc2e157eefe6facb983b1d557b3a1 wewe:2a7d544ccb742bd155e55c796de8e511 Here is my code:
public void DeleteUser() { var log = EnterLogin(); string path = ".htpasswd"; string[] deluser = System.IO.File.ReadAllLines(path, Encoding.Default); foreach (string items in deluser) { if (items.Contains(log)) { } } }