C
C#3mo ago
Mekasu0124

Visual Studio not placing `{}` on new line

internal static bool ValidatePassword(string password)
{
if (string.IsNullOrEmpty(password) || string.IsNullOrWhiteSpace(password))
{
return false;
}

return Regex.IsMatch(password, PasswordRegex);
}

internal static bool ValidateName(string name) {
if (string.IsNullOrEmpty(username) || string.IsNullOrWhiteSpace(username)) {
return false;
}
return Regex.IsMatch(name, NameRegex);
}
internal static bool ValidatePassword(string password)
{
if (string.IsNullOrEmpty(password) || string.IsNullOrWhiteSpace(password))
{
return false;
}

return Regex.IsMatch(password, PasswordRegex);
}

internal static bool ValidateName(string name) {
if (string.IsNullOrEmpty(username) || string.IsNullOrWhiteSpace(username)) {
return false;
}
return Regex.IsMatch(name, NameRegex);
}
when I create a new class, function, if/else statement, try/catch/finally clause, etc and I type it out internal static void MyFunction() { and I press Enter on that beginning { or I do it with the other items I listed, Visual Studio does not place the { } on a new line as shown above. In the above code, the ValidatePassword function is the way I want it to be and the function ValidateName is how Visual Studio 2022 current does it and I have to manually fix it every time. In the screenshot you can see I have all the settings turned on that the couple of StackOverflow post answers have mentioned, but nothing is working. I've also tried unchecking every box, reloading the editor, trying it out, checking them all back, reloading editor, and trying it out again, and it still doesn't do anything. Thanks in advance
No description
1 Reply
Mekasu0124
Mekasu01243mo ago
.