How to check if two values are in the same child of a class?
The user inputs their username and then their password. I want to check to see if both inputs are in the same child of the class.
13 Replies
What do you mean by child?
my bad i meant like the object
made from my class so the object would include their username and password
You might need to show some code because it's not very clear what you are asking.
my bad, is how im making my objects
is how my class is set up
so basically what im trying to check is if the accountnumber that the user inputs contains a matching pin in one of the objects I have made
Well, check that, then
userInput.Contains(someAccount.Pin)
(as a side note, most of your code is useless Java-isms, C# has autoproperties, no need to waste time writing getter and setter methods)ohh ok nice ill fix that in a few
so I'm in the process of doing that right now but whenever I try to access my objects I get the output of
How are you accessing them and how are you getting the output?
Well, your account doesn't override the
ToString()
method so you'll just get the class name
If you want to print all properties of the object, you can try serializing it to JSON
or some suchokok that makes sense
Im trying to make the login right now and when I do it tells me that accountNumber and accountPIN dont exist in the current context
currentaccountNumber and currentPIN1 are the user input
Well, do they exist?
$scopes
thing a
is available in scope A
and scope B
thing b
is available only in scope B