strings match? | Sololearn: Learn to code for FREE!


strings match?

hi, just asking: how can I check if the content of two string is identical? like a password checker or something like that.(C#) thank you.

3/17/2019 6:48:38 PM

Fabrizio Piperno

6 Answers

New Answer


You can use "Equals" method to check if strings are equal or not. You can see my example code. You can find more info about "Equals" method here: Hope it helps you.


//Using conditional like following int pass1=1234; int pass2=1234; if (pass1 == pass2){ Console.WriteLine("password marched"); }else{ Console.WriteLine("Not matched"); }


Fabrizio Piperno, if you need user input use for example => string mystr = Console.ReadLine();


ok, and if i want to get the user input?


Thank You❤️


Fabrizio Piperno , you are welcome 😉