Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ internal bool LoadUsingModulePath(PSModuleInfo parentModule, bool found, IEnumer
foreach (string folder in Directory.EnumerateDirectories(path))
{
string moduleName = Path.GetFileName(folder);
if (string.Compare(moduleName, fileBaseName, StringComparison.OrdinalIgnoreCase) == 0)
if (string.Equals(moduleName, fileBaseName, StringComparison.OrdinalIgnoreCase))
{
fileBaseName = moduleName;
#endif
Expand Down Expand Up @@ -3531,7 +3531,7 @@ private static void PropagateExportedTypesFromNestedModulesToRootModuleScope(Imp
if (nestedModule != null)
{
var exportedTypes = nestedModule.GetExportedTypeDefinitions();
if (exportedTypes != null && exportedTypes.Count != 0)
if (exportedTypes != null && exportedTypes.Count > 0)
{
foreach (var t in exportedTypes)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private static void RegisterSubsystem(SubsystemInfo subsystemInfo, ISubsystem pr
nameof(proxy));
}

if (subsystemInfo.RequiredCmdlets.Any() || subsystemInfo.RequiredFunctions.Any())
if (subsystemInfo.RequiredCmdlets.Count > 0 || subsystemInfo.RequiredFunctions.Count > 0)
{
// Process 'proxy.CmdletImplementationAssembly' and 'proxy.FunctionsToDefine'
// Functions are added to global scope.
Expand Down Expand Up @@ -265,7 +265,7 @@ public static void UnregisterSubsystem(SubsystemKind kind, Guid id)

private static void UnregisterSubsystem(SubsystemInfo subsystemInfo, Guid id)
{
if (subsystemInfo.RequiredCmdlets.Any() || subsystemInfo.RequiredFunctions.Any())
if (subsystemInfo.RequiredCmdlets.Count > 0 || subsystemInfo.RequiredFunctions.Count > 0)
{
throw new NotSupportedException("NotSupported yet: unregister subsystem that introduced new cmdlets/functions.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ internal static bool Contains(Ast ast, Func<Ast, bool> predicate, bool searchNes

var searcher = new AstSearcher(predicate, stopOnFirst: true, searchNestedScriptBlocks: searchNestedScriptBlocks);
ast.InternalVisit(searcher);
return searcher.Results.Any();
return searcher.Results.Count > 0;
}

internal static bool IsUsingDollarInput(Ast ast)
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/utils/EncodingUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ internal static Encoding Convert(Cmdlet cmdlet, string encoding)
if (encodingMap.TryGetValue(encoding, out foundEncoding))
{
// Write a warning if using utf7 as it is obsolete in .NET5
if (string.Compare(encoding, Utf7, StringComparison.OrdinalIgnoreCase) == 0)
if (string.Equals(encoding, Utf7, StringComparison.OrdinalIgnoreCase))
{
cmdlet.WriteWarning(PathUtilsStrings.Utf7EncodingObsolete);
}
Expand Down