Hi,
Lets suppose this is your class:
public class Users
{
public int ID { get; set; }
public string UserName { get; set; }
public string Email { get; set; }
public string Password { get; set; }
public Users(int id,string username, string email,string password)
{
ID = id;
Email = email;
UserName = username;
Password = password;
}
}
Now use this function to compare the values that are entered by the user.
public IEnumerable<users> ReadCSV(string fileName)
{
string[] lines = File.ReadAllLines(System.IO.Path.ChangeExtension(fileName, ".csv"));
return lines.Select(line =>
{
string[] data = line.Split(';');
return new Users(Convert.ToInt32(data[0]), data[1], data[2], data[3]);
});
}
</users></users>
Now you traverse this and match that if the user name and password exists.
I am not sure whether this is the right approach or not.
Also, I agree with Sergey. And in case you want to save password by using hash functions, you can change the code as per your requirement.
Regards,
Praneet