# CA1859: Use concrete types when possible for improved performance
dotnet_diagnostic.CA1859.severity = warning
+# CA1860: Prefer Length/Count/IsEmpty property check over Any()
+dotnet_diagnostic.CA1860.severity = warning
+
# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = none
# CA1859: Use concrete types when possible for improved performance
dotnet_diagnostic.CA1859.severity = none
+# CA1860: Prefer Length/Count/IsEmpty property check over Any()
+dotnet_diagnostic.CA1860.severity = none
+
# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = none
var typeOrNamespaceName = nameBuilder.ToString();
GetMatchingTypes(module, declaringType: containingType, name: typeOrNamespaceName, arity: arity, results: results);
Debug.Assert(results.Count <= 1);
- if (results.Any())
+ if (results.Count != 0)
{
// the name resolved to a type
var result = results.Single();
.Select(e => new RuntimeFile(e.Path, e.AssemblyVersion, e.FileVersion))
.ToArray();
- if (groupRuntimeAssemblies.Any())
+ if (groupRuntimeAssemblies.Length != 0)
{
runtimeAssemblyGroups.Add(new RuntimeAssetGroup(
ridGroup.Key,
.Select(e => new RuntimeFile(e.Path, e.AssemblyVersion, e.FileVersion))
.ToArray();
- if (groupNativeLibraries.Any())
+ if (groupNativeLibraries.Length != 0)
{
nativeLibraryGroups.Add(new RuntimeAssetGroup(
ridGroup.Key,
Declare();
var entities = new List<FileSystemInfoBase?>();
- if (_declaredWildcardPathSegment || _declaredLiteralFileSegments.Any())
+ if (_declaredWildcardPathSegment || _declaredLiteralFileSegments.Count != 0)
{
entities.AddRange(directory.EnumerateFileSystemInfos());
}
public override bool Execute()
{
- if (RuntimeGroups != null && RuntimeGroups.Any() && RuntimeJson == null)
+ if (RuntimeGroups != null && RuntimeGroups.Length != 0 && RuntimeJson == null)
{
Log.LogError($"{nameof(RuntimeJson)} argument must be specified when {nameof(RuntimeGroups)} is specified.");
return false;
}
}
- if (_interfaceExports.Any())
+ if (_interfaceExports.Count != 0)
{
if (_typeExportBuilders != null)
{
internal void BuildPropertyAttributes(Type type, ref List<Tuple<object, List<Attribute>>> configuredMembers)
{
- if (_propertyImports.Any() || _propertyExports.Any())
+ if (_propertyImports.Count != 0 || _propertyExports.Count != 0)
{
foreach (PropertyInfo pi in type.GetProperties())
{
}
// Notify anyone sourcing exports that the resurrected exports have appeared
- if (resurrectedExports.Any())
+ if (resurrectedExports.Count != 0)
{
OnExportsChanging(
new ExportsChangeEventArgs(resurrectedExports, Array.Empty<ExportDefinition>(), localAtomicComposition));
if (disposableExports == null)
{
_importedDisposableExports.Remove(import);
- if (!_importedDisposableExports.Any())
+ if (_importedDisposableExports.Count == 0)
{
_importedDisposableExports = null;
}
}
}
- if (_interfaceExports.Any())
+ if (_interfaceExports.Count != 0)
{
if (_typeExportBuilders != null)
{
internal void BuildPropertyAttributes(Type type, ref List<Tuple<object, List<Attribute>>> configuredMembers)
{
- if (_propertyImports.Any() || _propertyExports.Any())
+ if (_propertyImports.Count != 0 || _propertyExports.Count != 0)
{
foreach (PropertyInfo pi in type.GetRuntimeProperties())
{
_constructor = GetConstructorInfoFromGenericType(_partType);
}
- _constructor ??= _partType.DeclaredConstructors.FirstOrDefault(ci => ci.IsPublic && !(ci.IsStatic || ci.GetParameters().Any()));
+ _constructor ??= _partType.DeclaredConstructors.FirstOrDefault(ci => ci.IsPublic && !(ci.IsStatic || ci.GetParameters().Length != 0));
if (_constructor == null)
{
elementStatements.AddRange(_elementMarshaller.Generate(localElementInfo, elementSubContext));
}
- if (elementStatements.Any())
+ if (elementStatements.Count != 0)
{
StatementSyntax marshallingStatement = Block(
List(_elementMarshaller.Generate(localElementInfo, elementSetupSubContext)
protected async Task SetBreakpoint(SessionId sessionId, DebugStore store, BreakpointRequest req, bool sendResolvedEvent, bool fromEnC, CancellationToken token)
{
ExecutionContext context = GetContext(sessionId);
- if ((!fromEnC && req.Locations.Any()) || (fromEnC && req.Locations.Any(bp => bp.State == BreakpointState.Active)))
+ if ((!fromEnC && req.Locations.Count != 0) || (fromEnC && req.Locations.Any(bp => bp.State == BreakpointState.Active)))
{
if (!fromEnC)
Log("debug", $"locations already loaded for {req.Id}");
{
string[] classFiles = Directory.GetFiles(Path.Combine(OutputDir, "obj"), "*.class", SearchOption.AllDirectories);
- if (!classFiles.Any())
+ if (classFiles.Length == 0)
throw new InvalidOperationException("Didn't find any .class files");
Utils.RunProcess(logger, d8, $"--no-desugaring {string.Join(" ", classFiles)}", workingDir: OutputDir);
}
}
- if (((!ForceInterpreter && (isDevice || ForceAOT)) && !assemblerFiles.Any()))
+ if (!ForceInterpreter && (isDevice || ForceAOT) && assemblerFiles.Count == 0)
{
throw new InvalidOperationException("Need list of AOT files for device builds.");
}
{
string[] classFiles = Directory.GetFiles(inputDir, "*.class", SearchOption.AllDirectories);
- if (!classFiles.Any())
+ if (classFiles.Length == 0)
throw new InvalidOperationException("Didn't find any .class files");
Utils.RunProcess(_logger, _androidSdk.D8Path, $"--no-desugaring {string.Join(" ", classFiles)}", workingDir: _workingDir);
public static bool Install(PackageReference[] references, string nugetConfigContents, string baseTempDir, TaskLoggingHelper logger, bool stopOnMissing=true, string? packagesPath=null)
{
- if (!references.Any())
+ if (references.Length == 0)
return true;
return new PackageInstaller(nugetConfigContents, baseTempDir, packagesPath, logger)