79532076

Date: 2025-03-24 20:30:25
Score: 3.5
Natty:
Report link

Do you need explanation how static classes work or do you know how they work now?

The way you wrote it only 1 User credentials can be saved at a time. If you have multiple users it would be better to have some data structure as storage of your users and pass reference to this structure in constructor of Form or you could have this structure as static attribute in your current Credentials class (this would be easier so you don't have to change a lot of your existing code)

for example you could use "public static List<(string, string)> list = new List<(string, string)>();"

to add items you just use "list.Add(("userEmail","userPassword"));". To get data you would have to iterate using loop of your choice. If you choose anything that isn't foreach you have to access data using indexer (like array) => list[indexOfUser].Item1/list[0].Item2; -with Item1 and Item2 you access each individual string, so for you Item1 is userEmail and Item2 is userPassword.

and for validation you can check if inserted email is in your list using loop and checking Item1. If you find a match check password.

Reasons:
  • RegEx Blacklisted phrase (2.5): do you know how
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Martin Václavík