GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Cleanup: Use EndsWith(char) and StartsWith(char) (#9994) · Thatgfsj-contribs/PowerShell@05242d7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • Microsoft.PowerShell.Commands.Diagnostics
      • GetEventCommand.cs
    • Microsoft.PowerShell.Commands.Management/commands/management
      • ClearRecycleBinCommand.cs
      • Computer.cs
      • ResolvePathCommand.cs
    • Microsoft.PowerShell.Commands.Utility/commands/utility
      • CsvCommands.cs
    • Microsoft.PowerShell.ConsoleHost/host/msh
      • CommandLineParameterParser.cs
    • Microsoft.WSMan.Management
      • ConfigProvider.cs
      • WsManHelper.cs
    • System.Management.Automation
      • engine
        • CommandCompletion
          • CommandCompletion.cs
          • CompletionAnalysis.cs
          • CompletionCompleters.cs
        • CommandDiscovery.cs
        • CommandInfo.cs
        • CommonCommandParameters.cs
        • MshCommandRuntime.cs
      • help
        • UpdatableHelpSystem.cs
      • namespaces
        • FileSystemProvider.cs
        • LocationGlobber.cs
        • RegistryProvider.cs
      • utils
        • PathUtils.cs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs‎

Copy file name to clipboardExpand all lines: src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ private string BuildStructuredQueryFromHashTable(EventLogSession eventLogSession
12941294
string query = queriedLogsQueryMap[keyLogName];
12951295
result.Append(query);
12961296

1297-
if (query.EndsWith("*", StringComparison.OrdinalIgnoreCase))
1297+
if (query.EndsWith('*'))
12981298
{
12991299
//
13001300
// No provider predicate: just add the XPath string
Collapse file

‎src/Microsoft.PowerShell.Commands.Management/commands/management/ClearRecycleBinCommand.cs‎

Copy file name to clipboardExpand all lines: src/Microsoft.PowerShell.Commands.Management/commands/management/ClearRecycleBinCommand.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ private string GetDrivePath(string driveName)
171171
{
172172
drivePath = driveName;
173173
}
174-
else if (driveName.EndsWith(":", StringComparison.OrdinalIgnoreCase))
174+
else if (driveName.EndsWith(':'))
175175
{
176176
drivePath = driveName + "\\";
177177
}
Collapse file

‎src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs‎

Copy file name to clipboardExpand all lines: src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1898,7 +1898,7 @@ internal static bool ContainsSystemDrive(string[] drives, string sysdrive)
18981898
string driveApp;
18991899
foreach (string drive in drives)
19001900
{
1901-
if (!drive.EndsWith("\\", StringComparison.OrdinalIgnoreCase))
1901+
if (!drive.EndsWith('\\'))
19021902
{
19031903
driveApp = string.Concat(drive, "\\");
19041904
}
Collapse file

‎src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs‎

Copy file name to clipboardExpand all lines: src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected override void ProcessRecord()
123123
// Do not insert './' if result path is not relative
124124
if (!adjustedPath.StartsWith(
125125
currentPath.Drive?.Root ?? currentPath.Path, StringComparison.OrdinalIgnoreCase) &&
126-
!adjustedPath.StartsWith(".", StringComparison.OrdinalIgnoreCase))
126+
!adjustedPath.StartsWith('.'))
127127
{
128128
adjustedPath = SessionState.Path.Combine(".", adjustedPath);
129129
}
Collapse file

‎src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs‎

Copy file name to clipboardExpand all lines: src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ internal void ReadHeader()
13011301
values[0] = values[0].Substring(9);
13021302
Header = values;
13031303
}
1304-
else if (values.Count != 0 && values[0].StartsWith("#"))
1304+
else if (values.Count != 0 && values[0].StartsWith('#'))
13051305
{
13061306
// Skip all lines starting with '#'
13071307
}
Collapse file

‎src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs‎

Copy file name to clipboardExpand all lines: src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ bool TryGetBoolValue(string arg, out bool boolValue)
11601160

11611161
if (!System.IO.File.Exists(_file))
11621162
{
1163-
if (args[i].StartsWith("-") && args[i].Length > 1)
1163+
if (args[i].StartsWith('-') && args[i].Length > 1)
11641164
{
11651165
string param = args[i].Substring(1, args[i].Length - 1).ToLower();
11661166
StringBuilder possibleParameters = new StringBuilder();
Collapse file

‎src/Microsoft.WSMan.Management/ConfigProvider.cs‎

Copy file name to clipboardExpand all lines: src/Microsoft.WSMan.Management/ConfigProvider.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2969,7 +2969,7 @@ private string GetFilterString(Hashtable cmdlinevalues, string[] pkey)
29692969
}
29702970
}
29712971

2972-
if (filter.ToString().EndsWith("+", StringComparison.OrdinalIgnoreCase))
2972+
if (filter.ToString().EndsWith('+'))
29732973
filter.Remove(filter.ToString().Length - 1, 1);
29742974
return filter.ToString();
29752975
}
Collapse file

‎src/Microsoft.WSMan.Management/WsManHelper.cs‎

Copy file name to clipboardExpand all lines: src/Microsoft.WSMan.Management/WsManHelper.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ internal string GetURIWithFilter(string uri, string filter, Hashtable selectorse
922922
if (operation.Equals("remove", StringComparison.OrdinalIgnoreCase))
923923
{
924924
sburi.Append(GetFilterString(selectorset));
925-
if (sburi.ToString().EndsWith("?", StringComparison.OrdinalIgnoreCase))
925+
if (sburi.ToString().EndsWith('?'))
926926
{
927927
sburi.Remove(sburi.Length - 1, 1);
928928
}
Collapse file

‎src/System.Management.Automation/engine/CommandCompletion/CommandCompletion.cs‎

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/CommandCompletion/CommandCompletion.cs
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ internal static List<CompletionResult> PSv2GenerateMatchSetOfFiles(PowerShellExe
887887

888888
lastWord = lastWord ?? string.Empty;
889889
bool isLastWordEmpty = string.IsNullOrEmpty(lastWord);
890-
bool lastCharIsStar = !isLastWordEmpty && lastWord.EndsWith("*", StringComparison.Ordinal);
890+
bool lastCharIsStar = !isLastWordEmpty && lastWord.EndsWith('*');
891891
bool containsGlobChars = WildcardPattern.ContainsWildcardCharacters(lastWord);
892892

893893
string wildWord = lastWord + "*";
@@ -1045,9 +1045,9 @@ private static bool PSv2ShouldFullyQualifyPathsPath(PowerShellExecutionHelper he
10451045
{
10461046
// These are special cases, as they represent cases where the user expects to
10471047
// see the full path.
1048-
if (lastWord.StartsWith("~", StringComparison.OrdinalIgnoreCase) ||
1049-
lastWord.StartsWith("\\", StringComparison.OrdinalIgnoreCase) ||
1050-
lastWord.StartsWith("/", StringComparison.OrdinalIgnoreCase))
1048+
if (lastWord.StartsWith('~') ||
1049+
lastWord.StartsWith('\\') ||
1050+
lastWord.StartsWith('/'))
10511051
{
10521052
return true;
10531053
}
Collapse file

‎src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs‎

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ internal List<CompletionResult> GetResultHelper(CompletionContext completionCont
387387
}
388388

389389
// Handle scenarios like this: dir -path:<tab>
390-
if (completionContext.WordToComplete.EndsWith(":", StringComparison.Ordinal))
390+
if (completionContext.WordToComplete.EndsWith(':'))
391391
{
392392
replacementIndex = tokenAtCursor.Extent.EndScriptPosition.Offset;
393393
replacementLength = 0;

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.