How do I verify in C# that the password contains at least X uppercase letters and at least Y numbers, and the entire string is longer than Z?
Thanks.
Short and clear using LINQ Where() method:
int requiredDigits = 5; int requiredUppercase = 5; string password = "SomE TrickY PassworD 12345"; bool isValid = password.Where(Char.IsDigit).Count() >= requiredDigits && password.Where(Char.IsUpper).Count() >= requiredUppercase;