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 — Code cleanup: use IndexOf(char) overload (#9722) · PowerShell/PowerShell@dd7e45f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • Microsoft.PowerShell.Commands.Management/commands/management
      • Computer.cs
      • ControlPanelItemCommand.cs
      • ParsePathCommand.cs
    • System.Management.Automation
      • engine
        • CommandCompletion
          • CompletionCompleters.cs
        • LanguagePrimitives.cs
        • Modules
          • ModuleCmdletBase.cs
        • ParameterSetInfo.cs
        • parser
          • ast.cs
        • remoting
          • commands
            • CustomShellCommands.cs
          • common
            • RunspaceConnectionInfo.cs
      • help
        • SaveHelpCommand.cs
      • namespaces
        • FileSystemProvider.cs
        • LocationGlobber.cs
        • RegistryProvider.cs
        • TransactedRegistryKey.cs
Expand file treeCollapse file tree
Open diff view settings
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
@@ -1808,7 +1808,7 @@ internal static string GetLocalAdminUserName(string computerName, PSCredential p
18081808
}
18091809
else
18101810
{
1811-
int dotIndex = computerName.IndexOf(".", StringComparison.OrdinalIgnoreCase);
1811+
int dotIndex = computerName.IndexOf('.');
18121812
if (dotIndex == -1)
18131813
{
18141814
localUserName = computerName + "\\" + psLocalCredential.UserName;
Collapse file

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

Copy file name to clipboardExpand all lines: src/Microsoft.PowerShell.Commands.Management/commands/management/ControlPanelItemCommand.cs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ private static bool CompareVerbActionOpen(string verbActionName)
227227
{
228228
string canonicalName = (string)item.ExtendedProperty("System.ApplicationName");
229229
canonicalName = !string.IsNullOrEmpty(canonicalName)
230-
? canonicalName.Substring(0, canonicalName.IndexOf("\0", StringComparison.OrdinalIgnoreCase))
230+
? canonicalName.Substring(0, canonicalName.IndexOf('\0'))
231231
: null;
232232

233233
if (canonicalName != null && canonicalName.Equals(RegionCanonicalName, StringComparison.OrdinalIgnoreCase))
@@ -452,7 +452,7 @@ internal List<ShellFolderItem> GetControlPanelItemByCanonicalName(List<ShellFold
452452
string path = item.Path;
453453
string canonicalName = (string)item.ExtendedProperty("System.ApplicationName");
454454
canonicalName = canonicalName != null
455-
? canonicalName.Substring(0, canonicalName.IndexOf("\0", StringComparison.OrdinalIgnoreCase))
455+
? canonicalName.Substring(0, canonicalName.IndexOf('\0'))
456456
: null;
457457

458458
if (canonicalName == null)
@@ -640,7 +640,7 @@ protected override void ProcessRecord()
640640
string description = (string)item.ExtendedProperty("InfoTip");
641641
string canonicalName = (string)item.ExtendedProperty("System.ApplicationName");
642642
canonicalName = canonicalName != null
643-
? canonicalName.Substring(0, canonicalName.IndexOf("\0", StringComparison.OrdinalIgnoreCase))
643+
? canonicalName.Substring(0, canonicalName.IndexOf('\0'))
644644
: null;
645645
int[] categories = (int[])item.ExtendedProperty("System.ControlPanel.Category");
646646
string[] cateStrings = new string[categories.Length];
Collapse file

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

Copy file name to clipboardExpand all lines: src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ protected override void ProcessRecord()
300300
continue;
301301

302302
case qualifierSet:
303-
int separatorIndex = pathsToParse[index].IndexOf(":", StringComparison.CurrentCulture);
303+
int separatorIndex = pathsToParse[index].IndexOf(':');
304304

305305
if (separatorIndex < 0)
306306
{
@@ -449,7 +449,7 @@ private string RemoveQualifier(string path)
449449

450450
if (SessionState.Path.IsProviderQualified(path))
451451
{
452-
int index = path.IndexOf("::", StringComparison.CurrentCulture);
452+
int index = path.IndexOf("::", StringComparison.Ordinal);
453453

454454
if (index != -1)
455455
{
Collapse file

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

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6600,7 +6600,7 @@ internal static void CompleteMemberHelper(
66006600
}
66016601

66026602
string tooltip = memberInfo.ToString();
6603-
if (tooltip.IndexOf("),", StringComparison.OrdinalIgnoreCase) != -1)
6603+
if (tooltip.IndexOf("),", StringComparison.Ordinal) != -1)
66046604
{
66056605
var overloads = tooltip.Split(new[] { ")," }, StringSplitOptions.RemoveEmptyEntries);
66066606
var newTooltip = new StringBuilder();
Collapse file

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

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/LanguagePrimitives.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,7 @@ internal static object GetConverter(Type type, TypeTable backupTypeTable)
15051505

15061506
private static object NewConverterInstance(string assemblyQualifiedTypeName)
15071507
{
1508-
int typeSeparator = assemblyQualifiedTypeName.IndexOf(",", StringComparison.Ordinal);
1508+
int typeSeparator = assemblyQualifiedTypeName.IndexOf(',');
15091509
if (typeSeparator == -1)
15101510
{
15111511
typeConversion.WriteLine("Type name \"{0}\" should be assembly qualified.", assemblyQualifiedTypeName);
Collapse file

‎src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs‎

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4680,7 +4680,7 @@ internal static bool IsRooted(string filePath)
46804680
filePath.StartsWith(@"../", StringComparison.Ordinal) ||
46814681
filePath.StartsWith(@"~/", StringComparison.Ordinal) ||
46824682
filePath.StartsWith(@"~\", StringComparison.Ordinal) ||
4683-
filePath.IndexOf(":", StringComparison.Ordinal) >= 0);
4683+
filePath.Contains(':'));
46844684
}
46854685

46864686
/// <summary>
Collapse file

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

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/ParameterSetInfo.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ internal static string GetParameterTypeString(Type type, IEnumerable<Attribute>
292292
}
293293

294294
// If the type is really an array, but the typename didn't include [], then add it.
295-
if (type.IsArray && (parameterTypeString.IndexOf("[]", StringComparison.OrdinalIgnoreCase) == -1))
295+
if (type.IsArray && (parameterTypeString.IndexOf("[]", StringComparison.Ordinal) == -1))
296296
{
297297
var t = type;
298298
while (t.IsArray)
Collapse file

‎src/System.Management.Automation/engine/parser/ast.cs‎

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/parser/ast.cs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8349,7 +8349,7 @@ internal Type GetGenericType(Type generic)
83498349
{
83508350
if (generic == null || !generic.ContainsGenericParameters)
83518351
{
8352-
if (TypeName.FullName.IndexOf("`", StringComparison.OrdinalIgnoreCase) == -1)
8352+
if (!TypeName.FullName.Contains('`'))
83538353
{
83548354
var newTypeName = new TypeName(Extent,
83558355
string.Format(CultureInfo.InvariantCulture, "{0}`{1}", TypeName.FullName, GenericArguments.Count));
@@ -8376,7 +8376,7 @@ public Type GetReflectionAttributeType()
83768376
Type generic = TypeName.GetReflectionAttributeType();
83778377
if (generic == null || !generic.ContainsGenericParameters)
83788378
{
8379-
if (TypeName.FullName.IndexOf("`", StringComparison.OrdinalIgnoreCase) == -1)
8379+
if (!TypeName.FullName.Contains('`'))
83808380
{
83818381
var newTypeName = new TypeName(Extent,
83828382
string.Format(CultureInfo.InvariantCulture, "{0}Attribute`{1}", TypeName.FullName, GenericArguments.Count));
Collapse file

‎src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs‎

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5436,7 +5436,7 @@ protected override void BeginProcessing()
54365436

54375437
if (!string.IsNullOrEmpty(this.Username))
54385438
{
5439-
if (this.Username.IndexOf("\\", StringComparison.OrdinalIgnoreCase) >= 0)
5439+
if (this.Username.Contains('\\'))
54405440
{
54415441
validator = null;
54425442

Collapse file

‎src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs‎

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,8 +1285,8 @@ private void UpdateUri(Uri uri)
12851285
(RemotingErrorIdStrings.RelativeUriForRunspacePathNotSupported));
12861286
}
12871287

1288-
if (uri.OriginalString.LastIndexOf(":", StringComparison.OrdinalIgnoreCase) >
1289-
uri.AbsoluteUri.IndexOf("//", StringComparison.OrdinalIgnoreCase))
1288+
if (uri.OriginalString.LastIndexOf(':') >
1289+
uri.AbsoluteUri.IndexOf("//", StringComparison.Ordinal))
12901290
{
12911291
UseDefaultWSManPort = false;
12921292
}
@@ -1296,7 +1296,7 @@ private void UpdateUri(Uri uri)
12961296
// http://localhost , http://127.0.0.1 etc.
12971297
string appname;
12981298

1299-
if (uri.AbsolutePath.Equals("/", StringComparison.OrdinalIgnoreCase) &&
1299+
if (uri.AbsolutePath.Equals("/", StringComparison.Ordinal) &&
13001300
string.IsNullOrEmpty(uri.Query) && string.IsNullOrEmpty(uri.Fragment))
13011301
{
13021302
appname = s_defaultAppName;

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.