Skip to content

Commit b25cb49

Browse files
authored
Empty string check optimization (#3826)
1 parent ebcb454 commit b25cb49

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FormatControl.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ private void UpdateControlVisibility(FormatTypeClass formatType)
261261
}
262262

263263
tableLayoutPanel1.SuspendLayout();
264-
secondRowLabel.Text = "";
264+
secondRowLabel.Text = string.Empty;
265265

266266
// process the decimalPlacesLabelVisible
267267
if (formatType.DropDownVisible)
@@ -315,14 +315,7 @@ private void UpdateControlVisibility(FormatTypeClass formatType)
315315
dateTimeFormatsListBox.Visible = false;
316316
}
317317

318-
if (secondRowLabel.Text == "")
319-
{
320-
secondRowLabel.Visible = false;
321-
}
322-
else
323-
{
324-
secondRowLabel.Visible = true;
325-
}
318+
secondRowLabel.Visible = secondRowLabel.Text.Length > 0;
326319

327320
tableLayoutPanel1.ResumeLayout(true /*performLayout*/);
328321
}

src/System.Windows.Forms/src/System/Windows/Forms/WebBrowser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ public Uri Url
611611
}
612612
set
613613
{
614-
if (value != null && value.ToString() == "")
614+
if (value != null && value.ToString().Length == 0)
615615
{
616616
value = null;
617617
}

0 commit comments

Comments
 (0)