Implemented interface members:
14 writes to Count
Microsoft.CodeAnalysis (5)
CodeGen\LocalSlotManager.cs (1)
297_addressedLocals.Count = countBefore;
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (1)
230Regions.Count = replaceWithCount - 1 + originalCount;
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithSimpleName.cs (1)
228localAliases.Count = localAliasCount;
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoReader.cs (1)
268flagsBuilder.Count = flagCount;
src\roslyn\src\Dependencies\Collections\TemporaryArray`1.cs (1)
242_builder.Count--;
Microsoft.CodeAnalysis.CSharp (9)
Binder\Binder_Attributes.cs (1)
383constructorArgumentSourceIndices.Count = lengthAfterRewriting;
Binder\Binder_Invocation.cs (1)
1304analyzedArguments.RefKinds.Count = analyzedArguments.Arguments.Count;
Binder\DecisionDagBuilder_CheckOrReachability.cs (1)
465currentCases.Count = savedStackCount;
Binder\DecisionDagBuilder.cs (1)
4178newSequence.Count = childCount;
Binder\PatternExplainer.cs (2)
169stack.Count = stackSize; 215stack.Count = stackSize;
CodeGen\EmitExpression.cs (1)
3077_expressionTemps.Count = exprTempsBefore;
Lowering\LocalRewriter\LocalRewriter.cs (1)
820statements.Count = remaining; // trim any trailing nulls
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
3338ownedParams.Count = _arity;
920 references to Count
Microsoft.CodeAnalysis (242)
CodeGen\ILBuilder.cs (6)
274while (reachableBlocks.Count != 0) 1012seqPoints[seqPoints.Count - 1] = seqPoint; 1017if (seqPoints.Count > 0) 1042Debug.Assert(this.SeqPointsOpt.Count == 0); 1255int marker = _allocatedILMarkers.Count; 1273Debug.Assert(ilMarker >= 0 && ilMarker < _allocatedILMarkers.Count, "Wrong builder?");
CodeGen\ItemTokenMap.cs (1)
48token = (uint)_items.Count;
CodeGen\LocalScopeManager.cs (3)
129if (result.Count > 0 && result[result.Count - 1].Length != expectedRootScopeLength) 508while (result.Count <= slotIndex)
CodeGen\LocalSlotManager.cs (4)
238slot: _lazyAllLocals.Count, 268return _addressedLocals.Count; 285if (markAsNotReusable && countBefore < _addressedLocals.Count) 288for (var i = countBefore; i < _addressedLocals.Count; i++)
CodeGen\SequencePointList.cs (2)
49if (seqPointBuilder.Count == 0) 55int totalPoints = seqPointBuilder.Count;
CodeGen\StringTokenMap.cs (1)
48token = (uint)_uniqueValues.Count;
Collections\ArrayBuilderExtensions.cs (1)
18if (builder.Count == 1)
Collections\OrderedSet.cs (1)
51return _list.Count;
Collections\OrderPreservingMultiDictionary.cs (1)
290internal int Count => (_value as ArrayBuilder<V>)?.Count ?? 1;
Collections\TopologicalSort.cs (3)
64while (ready.Count != 0) 85bool hadCycle = predecessorCounts.Count != resultBuilder.Count; 108while (toCount.Count != 0)
CommandLine\AnalyzerConfigSet.cs (3)
154Debug.Assert(builder.Count == config.NamedSections.Length); 159Debug.Assert(allMatchers.Count == _analyzerConfigs.Length); 457for (int i = 0; i < analyzerConfigs.Count; i++)
CommandLine\CommandLineParser.cs (5)
227if (parts.Count == 0 || parts[0].Length == 0) 243if (parts.Count > 1 && parts[1].Length > 0) 260if (parts.Count > 2) 841int length = parts.Count; 1071for (var i = 0; i < builder.Count; i++)
DiagnosticAnalyzer\AnalyzerDriver.cs (4)
1482while (kind >= actionsByKindBuilder.Count) 1883Debug.Assert(completedAnalyzers.Count < analysisScope.Analyzers.Length); 2693var filteredNodesToAnalyze = ArrayBuilder<SyntaxNode>.GetInstance(nodesToAnalyze.Count); 3061Debug.Assert(operationsToAnalyze.ToImmutableHashSet().Count == operationsToAnalyze.Count);
DiagnosticAnalyzer\AnalyzerFileReference.cs (1)
662for (var i = builder.Count - 1; i >= 0; i--)
Emit\EditAndContinue\DeltaMetadataWriter.cs (4)
533if (deletedMemberDefs?.Count > 0) 1090int previousCustomAttributeRowIdsCount = CustomAttributeRowIds.Count; 1100if (CustomAttributeRowIds.Count > previousCustomAttributeRowIdsCount) 1390Debug.Assert(debugTokens.Distinct().Count() == debugTokens.Count);
Emit\EditAndContinueMethodDebugInformation.cs (2)
233var closureId = new DebugId(closuresBuilder.Count, generation: 0); 247var lambdaId = new DebugId(lambdasBuilder.Count, generation: 0);
FileSystem\PathUtilities.cs (1)
901var partCount = resolvedParts.Count;
InternalUtilities\EnumField.cs (1)
42int end = sortedFields.Count;
InternalUtilities\SetWithInsertionOrder.cs (1)
85public int Count => _elements?.Count ?? 0;
NativePdbWriter\PdbWriter.cs (3)
404for (int i = nestedNamesReversed.Count - 1; i >= 0; i--) 473while (scopeStack.Count > 0) 492for (int i = scopeStack.Count - 1; i >= 0; i--)
Operations\ControlFlowGraphBuilder.BasicBlockBuilder.cs (1)
44public bool HasStatements => _statements?.Count > 0;
Operations\ControlFlowGraphBuilder.cs (49)
162Debug.Assert(builder._evalStack.Count == 0); 174var builder = ArrayBuilder<BasicBlock>.GetInstance(blockBuilders.Count); 238MarkReachableBlocks(blocks, firstBlockOrdinal: 0, lastBlockOrdinal: blocks.Count - 1, 316while (toVisit.Count != 0); 530for (int i = region.Regions.Count - 1; i >= 0; i--) 558if (region.Regions?.Count == 1) 577for (int i = region.Regions.Count - 1; i >= 0; i--) 695int count = blocks.Count - 1; 768Debug.Assert(tryAndFinally.Regions!.Count == 2); 1138if ((fromPredecessor.Count - lastLeftRegionOnTheWayFromPredecessorToCurrentBlock + 1139fromCurrent.Count - lastLeftRegionOnTheWayFromCurrentToDestination) != 1140(fromPredecessor.Count - lastLeftRegionOnTheWayFromPredecessorToDestination)) 1162else if (builder.Count != 0) 1182while (mismatch < from.Count && mismatch < to.Count && from[mismatch] == to[mismatch]) 1244int stackDepth = _evalStack.Count; 1259Debug.Assert(_evalStack.Count == stackDepth); 1324block.Ordinal = _blocks.Count; 1338Debug.Assert(_evalStack.Count == _startSpillingAt); 1405Debug.Assert(_evalStack.Count == 0 || _evalStack.Peek().frameOpt != null); 1414Debug.Assert(_evalStack.Count == 0 || _evalStack.Peek().frameOpt != null); 1695Debug.Assert(_startSpillingAt == _evalStack.Count); 1741int stackDepth = _evalStack.Count; 1824Debug.Assert(_startSpillingAt <= _evalStack.Count); 1841for (int i = _startSpillingAt; i < _evalStack.Count; i++) 1880for (int j = currentFrameIndex + 1; j < _evalStack.Count; j++) 1938_startSpillingAt = _evalStack.Count; 1962Debug.Assert(_evalStack.Count != 0); 1965Debug.Assert(_startSpillingAt <= _evalStack.Count); 1972int stackDepth = _evalStack.Count; 1989Debug.Assert(_startSpillingAt <= _evalStack.Count); 2032int stackSizeBefore = _evalStack.Count; 2039Debug.Assert(stackSizeBefore == _evalStack.Count); 2075startingStackDepth: _evalStack.Count - (instancePushed ? 1 : 0), 2245while (stack.Count != 0); 2793Debug.Assert(_startSpillingAt == _evalStack.Count); 2841else if (stack.Count == 0 && ReferenceEquals(dest, top.dest)) 2854while (stack.Count != 0); 2994Debug.Assert(_startSpillingAt >= _evalStack.Count - 1); 3481Debug.Assert(_currentConditionalAccessTracker.Operations.Count == 0); 3531Debug.Assert(!_currentConditionalAccessTracker.IsDefault && _currentConditionalAccessTracker.Operations.Count > 0); 4021if (resourceQueueOpt == null || resourceQueueOpt.Count == 0) 6422for (int i = 0; i < initializerBuilder.Count; i++) 6809int maxStackDepth = _evalStack.Count - 2; 6885int appendCallsLength = appendCalls.Count; 7049Debug.Assert(_evalStack.Count > _currentInterpolatedStringHandlerCreationContext.MaximumStackDepth); 7052|| targetStackDepth >= _evalStack.Count) 7490if (children.Count != 0 && children.Last().Kind == OperationKind.ObjectOrCollectionInitializer) 7507for (int i = children.Count - 1; i >= 0; i--)
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (16)
53public bool HasRegions => Regions?.Count > 0; 55public bool HasLocalFunctions => LocalFunctions?.Count > 0; 57public bool HasCaptureIds => CaptureIds?.Count > 0; 146Debug.Assert(Regions.Count <= 2); 147Debug.Assert(lastKind == (Regions.Count < 2 ? ControlFlowRegionKind.Filter : ControlFlowRegionKind.Catch)); 151if (Regions.Count == 1) 162Debug.Assert(Regions.Count <= 2); 163if (Regions.Count == 1) 188if (Regions.Count == 1) 210if (Regions.Count == 1) 220int replaceWithCount = replaceWith.Count; 229int originalCount = Regions.Count; 232for (int i = originalCount - 1, j = Regions.Count - 1; i > insertAt; i--, j--) 269Debug.Assert(Regions.Count == 1 && Regions.First().LastBlock == block); 307int localFunctionsBefore = localFunctions.Count; 321var builder = ArrayBuilder<ControlFlowRegion>.GetInstance(Regions.Count);
PEWriter\MetadataWriter.cs (1)
3961consolidatedTypeArguments.Count,
PEWriter\MetadataWriter.PortablePdb.cs (1)
545int lastNonZero = builder.Count - 1;
PEWriter\TypeNameSerializer.cs (1)
290for (int i = namesReversed.Count - 1; i >= 0; i--)
ReferenceManager\CommonReferenceManager.Binding.cs (15)
159Debug.Assert(referenceBindings.Count == allAssemblies.Length); 171var boundInputs = new BoundInputAssembly[referenceBindings.Count]; 172for (int i = 0; i < referenceBindings.Count; i++) 226Debug.Assert(referenceBindings.Count == explicitAssemblies.Length); 253while (referenceBindingsToProcess.Count > 0) 292int index = explicitAssemblyCount - 1 + metadataReferencesBuilder.Count; 318if (implicitAssemblies.Count == 0) 334implicitAssembliesMap.EnsureCapacity(implicitAssemblies.Count); 336for (int i = 0; i < implicitAssemblies.Count; i++) 343for (int bindingsIndex = 0; bindingsIndex < referenceBindings.Count; bindingsIndex++) 397Debug.Assert(result.Count == 0); 435Debug.Assert(result.Count == explicitModules.Length + totalReferencedAssemblyCount); 480var bindingsOfAssemblyBeingBuilt = ArrayBuilder<AssemblyReferenceBinding>.GetInstance(referenceBindingsOfAssemblyBeingBuilt.Length + implicitAssemblies.Count); 486for (int i = 0; i < implicitAssemblies.Count; i++) 1032if (corLibraryCandidates.Count == 1)
ReferenceManager\CommonReferenceManager.Resolution.cs (6)
292-assembliesBuilder.Count - 1, 340-assembliesBuilder.Count - 1, 417int count = (referenceMap[i].Kind == MetadataImageKind.Assembly) ? assembliesBuilder.Count : lazyModulesBuilder?.Count ?? 0; 640referenceMap[referenceIndex] = new ResolvedReference(assemblies.Count, MetadataImageKind.Assembly); 654referenceMap[referenceIndex] = new ResolvedReference(modules.Count, MetadataImageKind.Module);
ReferenceManager\CommonReferenceManager.State.cs (5)
496Debug.Assert(aliasesOfReferencedAssembliesBuilder.Count == assemblyIndex); 622Debug.Assert(bindingResult.Length == aliasesOfReferencedAssembliesBuilder.Count + 1); 633Debug.Assert(assemblyIndicesToProcess.Count == 0); 636while (assemblyIndicesToProcess.Count > 0) 664for (int i = 0; i < aliasesOfReferencedAssembliesBuilder.Count; i++)
ReferenceManager\MergedAliases.cs (2)
69if (aliases.Count == 0 ^ newAliases.IsEmpty) 100int originalCount = builder.Count;
SourceGeneration\AdditionalSourcesCollection.cs (3)
100for (int i = 0; i < _sourcesAdded.Count; i++) 117for (int i = 0; i < _sourcesAdded.Count; i++) 131if (asc._sourcesAdded.Count == 0 && asc._reservedHintNames.IsEmpty)
SourceGeneration\GeneratorDriver.cs (1)
334if (constantSourcesBuilder.Count > 0)
SourceGeneration\Nodes\BatchNode.cs (1)
106Debug.Assert(builder.Count == entryCount);
SourceGeneration\Nodes\NodeStateTable.cs (15)
172Debug.Assert(compacted.Count == nonRemovedCount); 267public int Count => _states.Count; 469var previousTableEntryIndex = _states.Count - _insertedCount; 482Debug.Assert(_steps.Count + 1 == _states.Count); 521Debug.Assert(!TrackIncrementalSteps || _states.Count == _steps.Count); 523if (_states.Count == 0) 533Debug.Assert(_requestedTableCapacity == null || _states.Count <= _requestedTableCapacity); 539if (_states.Count == _previous.Count && _states.SequenceEqual(_previous._states, (e1, e2) => e1.Matches(e2, _equalityComparer))) 657Debug.Assert(itemBuilder.Count < this.Count); 758for (int i = 0, n = _items.Count - 1; i < n; i++) 769Debug.Assert(_items.Count >= 1, "Created a builder with no values?"); 771Debug.Assert(_items.Count == _requestedCapacity); 772Debug.Assert(_states == null || _states.Count == _requestedCapacity);
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithSimpleName.cs (1)
222var localAliasCount = localAliases.Count;
SourceGeneration\SyntaxStore.cs (4)
81if (syntaxInputBuilders.Count > 0) 94for (int i = 0; i < syntaxInputBuilders.Count; i++) 132while (freedBuilderCount < syntaxInputBuilders.Count) 142while (freedBuilderCount < syntaxInputBuilders.Count)
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoReader.cs (3)
257Debug.Assert(flagsBuilder.Count == 0); 266if (flagCount < flagsBuilder.Count) 452Debug.Assert(groupBuilder.Count == 0);
src\roslyn\src\Dependencies\Collections\Extensions\FixedSizeArrayBuilder.cs (1)
93ThrowIfTrue(_index + values.Count > _values.Length);
src\roslyn\src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (4)
714if (comparer != null && builder.Count > 1) 841Debug.Assert(builder.Count > 1); 912Debug.Assert(builder.Count == count); 1207var result = (builder.Count == array.Length) ? array : builder.ToImmutable();
src\roslyn\src\Dependencies\Collections\TemporaryArray`1.cs (1)
107public readonly int Count => _builder?.Count ?? _count;
src\roslyn\src\Dependencies\PooledObjects\ArrayBuilder.cs (37)
48var result = new T[_builder.Count]; 94if (Count == 0) 98else if (_builder.Capacity == Count) 153=> Count == 0; 220=> FindIndex(0, this.Count, match); 223=> FindIndex(startIndex, this.Count - startIndex, match); 240=> FindIndex(0, Count, match, arg); 243=> FindIndex(startIndex, Count - startIndex, match, arg); 353if (this.Count <= 1) 378=> Count == 0 ? default : Last(); 395if (Count == 0) 409if (Count == 0) 414var result = new U[Count]; 438if (Count == 0) 442else if (_builder.Capacity == Count) 491if (this.Count != 0) 521Debug.Assert(builder.Count == 0); 616if (this.Count == 1) 624if (this.Count == 0) 631var accumulator = new Dictionary<K, ArrayBuilder<T>>(Count, comparer); 632for (var i = 0; i < Count; i++) 677Debug.Assert(start + length <= items.Count); 744Debug.Assert(limit <= Count); 756EnsureCapacity(Count + count); 769for (var i = 0; i < Count; i++) 784if (Count <= 1) 794for (int i = 1; i < Count; i++) 808var result = ArrayBuilder<S>.GetInstance(Count); 880switch (Count) 898var result = new TResult[Count]; 916switch (Count) 934var result = new TResult[Count]; 952switch (Count) 970var result = new TResult[Count]; 987RemoveAt(Count - 1); 993if (Count > 0) 1004=> this[Count - 1];
src\roslyn\src\Dependencies\PooledObjects\ArrayBuilder.Enumerator.cs (1)
36return _index < _builder.Count;
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (3)
269if (result == 0 && usedFieldsAndValues.Count > 0) 272for (int i = usedFieldsAndValues.Count - 1; i >= 0; i--) 274if (i != (usedFieldsAndValues.Count - 1))
SymbolDisplay\SymbolDisplayExtensions.cs (2)
63if (parts.Count == 0) 68if (parts.Count == 1)
Syntax\GreenNode.cs (1)
665while (stack.Count > 0)
Syntax\GreenNodeExtensions.cs (3)
25if (newAnnotations.Count == 0) 64if (newAnnotations.Count == existingAnnotations.Length) 88if (removalAnnotations.Count == 0)
Syntax\LineDirectiveMap.cs (1)
158for (int i = 0; i < entries.Count - 1; ++i)
Syntax\SyntaxNode.cs (1)
462while (stack.Count > 0)
Syntax\SyntaxNode.Iterators.cs (2)
254public bool IsNotEmpty { get { return _discriminatorStack?.Count > 0; } } 351public bool IsNotEmpty { get { return _discriminatorStack?.Count > 0; } }
Text\CompositeText.cs (10)
192if (segments.Count == 0) 196else if (segments.Count == 1) 208if (segments.Count > 1) 214for (int i = 1; i < segments.Count; i++) 248if (segments.Count > MAXIMUM_SEGMENT_COUNT_BEFORE_REDUCTION) 291for (int i = 0; i < segments.Count - 1; i++) 297for (int j = i + 1; j < segments.Count; j++) 316return segments.Count - numberOfSegmentsReduced; 324for (int i = 0; i < segments.Count - 1; i++) 332for (int j = i + 1; j < segments.Count; j++)
Text\SourceText.cs (1)
833if (position == 0 && segments.Count == 0)
Text\TextChangeRangeExtensions.cs (1)
385if (builder.Count > 0)
Microsoft.CodeAnalysis.CSharp (674)
Binder\Binder_Constraints.cs (3)
393Debug.Assert(typeParameters.Length == constraintClauses.Count); 435if (constraintTypeBuilder.Count < n) 511if (constraintTypes.Count > 0)
Binder\Binder_Conversions.cs (1)
2188Debug.Assert(methodGroup.Methods.Count > 0);
Binder\Binder_Crefs.cs (3)
366if (sortedSymbolsBuilder.Count > 1) 669if (builder.Count > 1) 1071if (viable.Count > 1)
Binder\Binder_Deconstruct.cs (10)
263if (variables.Count != tupleOrDeconstructedTypes.Length) 265Error(diagnostics, ErrorCode.ERR_DeconstructWrongCardinality, syntax, tupleOrDeconstructedTypes.Length, variables.Count); 271if (variables.Count < 2) 278BoundExpression deconstructInvocation = MakeDeconstructInvocationExpression(variables.Count, 295int count = variables.Count; 353var matchCount = Math.Min(variables.Count, foundTypes.Length); 395int count = variables.Count; 464return $"Nested variables ({NestedVariables.Count})"; 475int leftLength = lhsVariables.Count; 550int count = variables.Count;
Binder\Binder_Expressions.cs (69)
1185Debug.Assert(elementNames.Count == inferredElementNames.Count); 1186var builder = ArrayBuilder<bool>.GetInstance(elementNames.Count); 1187for (int i = 0; i < elementNames.Count; i++) 1224for (int i = 0; i < inferredElementNames.Count; i++) 1533Debug.Assert(!result || lookupResult.Symbols.Count > 0); 1708Debug.Assert(members.Count > 0); 2006Debug.Assert(members.Count > 0); 3192if (!hadError && isDelegateCreation && origRefKind != RefKind.None && result.Arguments.Count == 1) 3427int argCount = result.Arguments.Count; 3448int argCount = result.Arguments.Count; 3520for (int arg = 0; arg < arguments.Count; ++arg) 3554Debug.Assert(analyzedArguments.RefKinds.Count == 0 || analyzedArguments.RefKinds.Count == arguments.Count); 3555Debug.Assert(analyzedArguments.Names.Count == 0 || analyzedArguments.Names.Count == arguments.Count); 3556Debug.Assert(argsToParamsOpt.IsDefault || argsToParamsOpt.Length == arguments.Count); 3637if (arg + 1 == arguments.Count || result.ParameterFromArgument(arg + 1) != paramsIndex) 3670for (int i = 0; i < paramsArgsBuilder.Count; i++) 3689Debug.Assert(collectionArgs.Length == 1 || firstParamsArgument + collectionArgs.Length == arguments.Count); 3705if (analyzedArguments.RefKinds is { Count: > 0 } refKindsBuilder) 3710if (analyzedArguments.Names is { Count: > 0 } namesBuilder) 3817if (result.ArgsToParamsOpt.IsDefault && arguments.Count == parameters.Length) 3837for (int argumentIndex = 0; argumentIndex < arguments.Count; argumentIndex++) 4415knownSizes[dimension - 1] = initializers.Count; 4417else if (knownSizeOpt != initializers.Count) 5133for (int i = 0; i < analyzedArguments.Arguments.Count; i++) 5475for (int i = 0; i < arguments.Count; i++) 5538else if (analyzedArguments.Arguments.Count == 0) 5543else if (analyzedArguments.Names.Count != 0 || analyzedArguments.RefKinds.Count != 0 || analyzedArguments.Arguments.Count != 1) 5548var end = analyzedArguments.Arguments[analyzedArguments.Arguments.Count - 1].Syntax.Span.End; 5563BoundExpression argument = analyzedArguments.Arguments.Count >= 1 ? BindToNaturalType(analyzedArguments.Arguments[0], diagnostics) : null; 7232if (analyzedArguments.Arguments.Count > 0) 7234diagnostics.Add(ErrorCode.ERR_BadCtorArgCount, typeNode.Location, interfaceType, analyzedArguments.Arguments.Count); 7276if (analyzedArguments.Arguments.Count > 0) 8106Debug.Assert(symbols.Count > 0); 8607Debug.Assert(extensionMethodArguments.Arguments.Count == 0); 8608Debug.Assert(extensionMethodArguments.Names.Count == 0); 8609Debug.Assert(extensionMethodArguments.RefKinds.Count == 0); 8619if (originalArguments?.Names.Count > 0) 8625if (originalArguments?.RefKinds.Count > 0) 8664Debug.Assert(members.Count > 0); 9056for (int i = methodGroup.Methods.Count - 1; i >= 0; i--) 9080if (methodGroup.Methods.Count != 0) 9086if (methodGroup.Methods.Count == 0) 9610if (filteredCandidates is null || filteredCandidates.Count == 0) 9707if (filteredCandidates is null || filteredCandidates.Count == 0) 10191if (methodOrPropertyGroup.Count > 0) 10229if ((methodOrPropertyGroup.Count > 0) && 10257Debug.Assert(members.Count > 0); 10358if (analyzedArguments.Arguments.Count == 1 && 10439if (analyzedArguments.Names.Count > 0) 10652if (arguments.Names.Count > 0) 10667if (arguments.Arguments.Count != rank) 10674BoundExpression[] convertedArguments = new BoundExpression[arguments.Arguments.Count]; 10676for (int i = 0; i < arguments.Arguments.Count; ++i) 10859if (analyzedArguments.Names.Count > 0) 10874if (arguments.Count != 1) 10898int numArguments = analyzedArguments.Arguments.Count; 11322if (arguments.Names.Count > 0) 11419lookupSymbolOpt: methods.Count == 1 ? methods[0] : null, lookupError: null, BoundMethodGroupFlags.None, functionType: null, receiver, LookupResultKind.Viable) 11850var seenAnyApplicableCandidates = methods.Count != 0; 11908if (methods.Count == 0) 11921Debug.Assert(methods.Count != 0); 12092var methods = ArrayBuilder<MethodSymbol>.GetInstance(capacity: singleLookupResults.Count);
Binder\Binder_InterpolatedString.cs (3)
484Debug.Assert(partsArrayBuilder.Count >= 2); 964if (parameterNamesAndLocationsBuilder.Count > 1) 970Debug.Assert(parameterNamesAndLocationsBuilder.Count == 0 || parameterNamesAndLocationsBuilder[0] == null);
Binder\Binder_Invocation.cs (40)
277for (int i = 0; i < analyzedArguments.Arguments.Count; ++i) 507if (arguments.Names.Count == 0) 518for (int i = 0; i < arguments.Names.Count; i++) 534var builder = ArrayBuilder<BoundExpression>.GetInstance(arguments.Arguments.Count); 536for (int i = 0, n = builder.Count; i < n; i++) 929for (int i = 0; i < arguments.Count; ++i) 1048for (int i = 0, n = overloadResolutionResult.ResultsBuilder.Count; i < n; i++) 1085if (finalCandidates.Count == 0) 1185Debug.Assert(methodGroup.Methods.Count > 0); 1186Debug.Assert(((object)delegateTypeOpt == null) || (methodGroup.Methods.Count == 1)); 1226return CreateBadCall(node, methodGroup.Name, invokedAsExtensionMethod && analyzedArguments.Arguments.Count > 0 && (object)methodGroup.Receiver == (object)analyzedArguments.Arguments[0] ? null : methodGroup.Receiver, 1246if (analyzedArguments.Names is { Count: > 0 }) 1251if (analyzedArguments.RefKinds is { Count: > 0 }) 1302if (analyzedArguments.RefKinds.Count == 0) 1304analyzedArguments.RefKinds.Count = analyzedArguments.Arguments.Count; 1570for (var i = 0; i < argumentsBuilder.Count; i++) 1581Debug.Assert(i + 1 == argumentsBuilder.Count || 1597Debug.Assert(argumentsBuilder.Count >= parameters.Length); // Accounting for arglist cases 1598Debug.Assert(argumentRefKindsBuilder is null || argumentRefKindsBuilder.Count == 0 || argumentRefKindsBuilder.Count == argumentsBuilder.Count); 1599Debug.Assert(namesBuilder is null || namesBuilder.Count == 0 || namesBuilder.Count == argumentsBuilder.Count); 1600Debug.Assert(argsToParamsOpt.IsDefault || argsToParamsOpt.Length == argumentsBuilder.Count); 1631var argumentsCount = argumentsBuilder.Count; 1639defaultArguments[argumentsBuilder.Count] = true; 1642if (argumentRefKindsBuilder is { Count: > 0 }) 1648if (namesBuilder?.Count > 0) 1667if (argumentRefKindsBuilder is { Count: > 0 }) 1672if (namesBuilder is { Count: > 0 }) 1678Debug.Assert(argumentsBuilder.Count == parameters.Length); 1679Debug.Assert(argumentRefKindsBuilder is null || argumentRefKindsBuilder.Count == 0 || argumentRefKindsBuilder.Count == parameters.Length); 1680Debug.Assert(namesBuilder is null || namesBuilder.Count == 0 || namesBuilder.Count == parameters.Length); 1681Debug.Assert(argsToParamsBuilder is null || argsToParamsBuilder.Count == parameters.Length); 2151if (parameterListList.Count == MaxParameterListsForErrorRecovery) 2172if (parameterListList.Count == MaxParameterListsForErrorRecovery) 2186int argumentCount = analyzedArguments.Arguments.Count;
Binder\Binder_Lookup.cs (7)
450if (submissionSymbols.Symbols.Count > 0 && submissionSymbols.Symbols.First().Kind != lookingForOverloadsOfKind.Value) 465if (result.Symbols.Count == 0) 672switch (symbols.Count) 695Debug.Assert(symbols.Count >= 2); 699for (int i = 0; i < symbols.Count; i++) 1334var hidingCount = hidingSymbols.Count; 1336var hiddenCount = hiddenSymbols.Count;
Binder\Binder_Operators.cs (7)
448Debug.Assert(analyzedArguments.RefKinds.Count == 0); 922while (syntaxNodes.Count > 0) 1260Debug.Assert(stack.Count > 0 && stack.Peek().Left is BoundUnconvertedInterpolatedString); 1278Debug.Assert(stack.Count == 0); 3558Debug.Assert(analyzedArguments.RefKinds.Count == 0); 3806methods = ArrayBuilder<MethodSymbol>.GetInstance(lookupResult.Symbols.Count); 3819methods = ArrayBuilder<MethodSymbol>.GetInstance(lookupResult.Symbols.Count);
Binder\Binder_Patterns.cs (4)
2679Debug.Assert(binaryPatternStack.Count > 0); 2784Debug.Assert(candidates.Count >= 2); 2787for (int i = 1, n = candidates.Count; i < n; i++) 2793for (int i = 0, n = candidates.Count; i < n; i++)
Binder\Binder_Query.cs (1)
708x2m[x2m.Count - 1] = x2.Name;
Binder\Binder_Statements.cs (1)
480var symbol = result.Symbols.Count > 0 && result.IsMultiViable ?
Binder\Binder_Symbols.cs (7)
1458Debug.Assert(members.Count > 0); 2035if (symbols.Count > 1) 2042for (int i = 0; i < symbols.Count; i++) 2404Debug.Assert(symbols.Count > 0); 2409for (int i = 0; i < symbols.Count; i++) 2423if ((symbols.Count > 1) || (symbols[0] is NamespaceOrTypeSymbol || symbols[0] is AliasSymbol) || 2565for (int i = 0; i < symbols.Count; i++)
Binder\Binder.CapturedParametersFinder.cs (1)
70if (captured.Count == 0)
Binder\Binder.IdentifierUsedAsValueFinder.cs (1)
285Debug.Assert(members.Count > 0);
Binder\DecisionDagBuilder_CheckOrReachability.cs (24)
83Debug.Assert(noPreviousCases.Count == 0); 446int savedStackCount = currentCases.Count; 454for (int i = 0; i < patterns.Count; i++) 522using var casesBuilder = TemporaryArray<StateForCase>.GetInstance(orCases.Count); 768while (evalPosition < _evalSequence.Count); 852int startOfLeft = _evalSequence.Count; 854int endOfLeft = _evalSequence.Count - 1; 863int startOfRight = _evalSequence.Count; 865int endOfRight = _evalSequence.Count - 1; 1072int startOfLeft = _evalSequence.Count; 1109Debug.Assert(_evalSequence.Count == startOfLeft + 1); 1111int startOfNestedPatterns = _evalSequence.Count; 1188if (_evalSequence.Count > startOfNestedPatterns || node.Variable is not null) 1198int endOfLeft = _evalSequence.Count - 1; 1199int startOfRight = _evalSequence.Count; 1201int endOfRight = _evalSequence.Count - 1; 1226int startOfLeft = _evalSequence.Count; 1237Debug.Assert(_evalSequence.Count == startOfLeft + 1); 1239int startOfNestedPatterns = _evalSequence.Count; 1271if (_evalSequence.Count > startOfNestedPatterns) 1289int startOfLeft = _evalSequence.Count; 1298Debug.Assert(_evalSequence.Count == startOfLeft + 1); 1300int startOfNestedPatterns = _evalSequence.Count; 1383if (_evalSequence.Count > startOfNestedPatterns)
Binder\DecisionDagBuilder.cs (20)
305while (testsToSimplify.Count != 0); 947int count = Math.Min(outParamTemps.Count, recursive.Deconstruction.Length); 2955&& arrayBuilder.Count < ArrayBuilder<T>.PooledArrayLengthLimitExclusive 2956&& arrayBuilder.Capacity >= arrayBuilder.Count * 2) 2968arrayBuilder.Capacity = arrayBuilder.Count; 2984public int Count => _arrayBuilder.Count; 3749for (int i = 0; i < oldOutParamTemps.Count; i++) 4110while (testsToFilter.Count != 0); 4200Debug.Assert(testsToAssemble.Count != 0); // If we have a child to rewrite, we must have a parent to reassemble. 4229while (testsToRewrite.Count != 0); 4262Debug.Assert(leftToRewriteBuilder.Count < childCount); 4282testsToAssemble[^1] = (ReassembleKind.And, childCount - leftToRewriteBuilder.Count, tempMapToRestore); 4319int leftToRewrite = leftToRewriteBuilder.Count; 4406while (testsToRewrite.Count != 0); 4469while (tests1.Count != 0); 4537while (tests.Count != 0); 4607for (int i = remainingTests.Count - 1; i >= 0; i--) 4625var result = remainingTests.Count switch 4713for (int i = remainingTests.Count - 1; i >= 0; i--) 4731var result = remainingTests.Count switch
Binder\ExpressionVariableFinder.cs (1)
334while (operands.Count > 0)
Binder\ForEachLoopBinder.cs (1)
1483Debug.Assert(analyzedArguments.Arguments.Count == 0);
Binder\Imports.cs (1)
137for (int i = nameParts.Count - 1; i >= 0; i--)
Binder\LookupResult.cs (3)
87return _kind == LookupResultKind.Empty && _error == null && _symbolList.Count == 0; 113return (_symbolList.Count == 1) ? _symbolList[0] : null; 151return Kind == LookupResultKind.Viable && _symbolList.Count == 1;
Binder\MethodGroupResolution.cs (2)
47Debug.Assert((methodGroup == null) || (methodGroup.Methods.Count > 0)); 103MethodGroup?.Methods.Count == 1 && // Local functions cannot be overloaded
Binder\PatternExplainer.cs (3)
152int stackSize = stack.Count; 227while (stack.Count > stackSize); 572return "(" + string.Join(", ", subpatterns) + ")" + (subpatterns.Count == 1 ? " { }" : null);
Binder\RefSafetyAnalysis.cs (1)
1188int n = variables.Count;
Binder\Semantics\AccessCheck.cs (1)
604while (baseInterfaces.Count != 0)
Binder\Semantics\BestTypeInferrer.cs (3)
167hadMultipleCandidates = candidateTypes.Count > 1; 189switch (types.Count) 199for (int i = 0; i < types.Count; i++)
Binder\Semantics\Conversions\ConversionsBase.cs (5)
3193Debug.Assert(typeParameters.Count == sourceTypeArguments.Count); 3194Debug.Assert(typeParameters.Count == destinationTypeArguments.Count); 3196for (int paramIndex = 0; paramIndex < typeParameters.Count; ++paramIndex)
Binder\Semantics\Conversions\UserDefinedConversions.cs (1)
90bool excludeExisting = result.Count > 0;
Binder\Semantics\Conversions\UserDefinedExplicitConversions.cs (2)
115if (u.Count == 0 && haveInterfaces) 234var originalOperatorCount = operators.Count;
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (2)
268if (u.Count == 0 && haveInterfaces) 1003if (ubuild.Count == 0)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (17)
33if (result.Results.Count > 0) 45Debug.Assert(result.Results.Count == 0); 69Debug.Assert(result.Results.Count == 0); 131Debug.Assert((result.Results.Count == 0) != hadApplicableCandidates); 204Debug.Assert((result.Results.Count == 0) != hadApplicableCandidates); 227Debug.Assert(candidates.Count == 0); 732Debug.Assert(operators.Count == 1); 830int initialCount = result.Count; 875Debug.Assert(results.Count == 0); 955Debug.Assert(operators.Count == 0); 967if (operators.Count != 0) 969for (int i = operators2.Count - 1; i >= 0; i--) 1022for (int i = operators.Count - 1; i >= 0; i--) 1130for (int index = 0; index < candidates.Count; ++index) 1141for (int i = 1; i < candidates.Count; ++i) 1176for (int index = 0; index < candidates.Count; index++) 1514for (int i = operators.Count - 1; i >= 0; i--)
Binder\Semantics\Operators\BinaryOperatorOverloadResolutionResult.cs (2)
79if (Results.Count == 0) 110for (int i = 0, n = this.Results.Count; i < n; i++)
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (10)
34Debug.Assert(result.Results.Count == 0); 38if (result.Results.Count > 0) 155for (int i = operators.Count - 1; i >= 0; i--) 335for (int index = 0; index < candidates.Count; ++index) 346for (int i = 1; i < candidates.Count; ++i) 380for (int index = 0; index < candidates.Count; index++) 775Debug.Assert(operators.Count == 0); 787if (operators.Count != 0) 789for (int i = operators2.Count - 1; i >= 0; i--) 856for (int i = operators.Count - 1; i >= 0; i--)
Binder\Semantics\Operators\UnaryOperatorOverloadResolutionResult.cs (2)
79if (Results.Count == 0) 110for (int i = 0, n = this.Results.Count; i < n; i++)
Binder\Semantics\OverloadResolution\AnalyzedArguments.cs (7)
49if (Names.Count == 0) 60int count = this.Names.Count; 67var builder = ArrayBuilder<string?>.GetInstance(this.Names.Count); 68for (int i = 0; i < this.Names.Count; ++i) 78return RefKinds.Count > 0 ? RefKinds[i] : Microsoft.CodeAnalysis.RefKind.None; 95bool hasRefKinds = RefKinds.Count > 0; 96for (int i = 0; i < Arguments.Count; i++)
Binder\Semantics\OverloadResolution\MemberAnalysisResult.cs (1)
453for (int i = 0; i < builder.Count; i++)
Binder\Semantics\OverloadResolution\MethodGroup.cs (3)
105return this.Methods.Count > 0 ? this.Methods[0].Name : null; 131Debug.Assert(this.Methods.Count == 0); 132Debug.Assert(this.TypeArguments.Count == 0);
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (14)
1954Debug.Assert(sourceTypeArguments.Count == targetTypeArguments.Count); 1956for (int arg = 0; arg < sourceTypeArguments.Count; ++arg) 2398Debug.Assert(typeParameters.Count == sourceTypeArguments.Count); 2399Debug.Assert(typeParameters.Count == targetTypeArguments.Count); 2401for (int arg = 0; arg < sourceTypeArguments.Count; ++arg) 2748Debug.Assert(typeParameters.Count == sourceTypeArguments.Count); 2749Debug.Assert(typeParameters.Count == targetTypeArguments.Count); 2751for (int arg = 0; arg < sourceTypeArguments.Count; ++arg) 3364builder.EnsureCapacity(builder.Count + candidates.Count);
Binder\Semantics\OverloadResolution\OverloadResolution_ArgsToParameters.cs (7)
78if (!expanded && arguments.Names.Count == 0) 85int argumentCount = arguments.Arguments.Count; 213int length = arguments.Arguments.Count; 269isNamedArgument = arguments.Names.Count > argumentPosition && arguments.Names[argumentPosition] != null; 355Debug.Assert(arguments.Names.Count == 0); 359int argumentCount = arguments.Arguments.Count; 501for (int i = 0; i < arguments.Names.Count; ++i)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (59)
230if (methods.Count == 0) 249unreducedMethods = ArrayBuilder<MethodSymbol>.GetInstance(methods.Count); 287if (applicableMethods.Length != methods.Count) 295var applicableMethods = ArrayBuilder<MethodSymbol>.GetInstance(methods.Count); 304if (applicableMethods.Count != methods.Count) 371if (checkOverriddenOrHidden && members.Count > 50) // TODO: fine-tune this value 377for (int i = 0; i < members.Count; i++) 499for (int f = 0; f < results.Count; ++f) 522for (int f = 0; f < results.Count; ++f) 562Debug.Assert(funcPtrBuilder.Count == 1); 612for (int f = 0; f < results.Count; ++f) 633for (int f = 0; f < results.Count; f++) 649for (int f = 0; f < results.Count; ++f) 685for (int i = 0; i < results.Count; i++) 862for (int f = 0; f < results.Count; ++f) 905for (int i = 0; i < members.Count; i++) 987arguments.Arguments.Count, 1031arguments.Arguments.Count, 1105if (members.Count < 2) 1173Debug.Assert(typeArguments.Count == 0 || typeArguments.Count == member.GetMemberArityIncludingExtension()); 1434for (var i = 0; i < members.Count; ++i) 1482for (int f = 0; f < results.Count; ++f) 1594for (int f = 0; f < results.Count; ++f) 1631for (int f = 0; f < results.Count; ++f) 1706for (int f = 0; f < results.Count; f++) 1727for (int f = 0; f < results.Count; f++) 1802for (int index = 0; index < results.Count; index++) 1872if (results.Count < 2) 1984for (int index = 0; index < results.Count; index++) 1999var worse = ArrayBuilder<int>.GetInstance(results.Count, unknown); 2004for (int c1Idx = 0; c1Idx < results.Count; c1Idx++) 2014for (int c2Idx = 0; c2Idx < results.Count; c2Idx++) 2045for (int i = 0; i < worse.Count; ++i) 2056for (int i = 0; i < worse.Count; ++i) 2078for (int i = 0; i < worse.Count; ++i) 2173for (i = 0; i < arguments.Count; ++i) 2181Debug.Assert(i == arguments.Count - 1); 2315for (i = i + 1; i < arguments.Count; ++i) 2323Debug.Assert(i == arguments.Count - 1); 2384if (m1ParametersUsedIncludingExpansionAndOptional == arguments.Count) 2388else if (m2ParametersUsedIncludingExpansionAndOptional == arguments.Count) 2451bool hasAll1 = m1.Result.Kind == MemberResolutionKind.ApplicableInExpandedForm || m1ParameterCount == arguments.Count; 2452bool hasAll2 = m2.Result.Kind == MemberResolutionKind.ApplicableInExpandedForm || m2ParameterCount == arguments.Count; 2477for (i = 0; i < arguments.Count; ++i) 2483Debug.Assert(i == arguments.Count - 1); 2546for (i = 0; i < arguments.Count; ++i) 2558if (i == arguments.Count) 2625for (int i = 0; i < arguments.Count; ++i) 2726if (arguments.Count < declaredParameterCount) 2743parametersUsedIncludingExpansionAndOptional = arguments.Count; 4082firstParamsElementIndex = types.Count; 4153arguments.Arguments.Count, 4222arguments.Arguments.Count, 4279if (typeArgumentsBuilder.Count == 0 && arguments.HasDynamicArgument && !inferWithDynamic) 4295if (typeArgumentsBuilder.Count > 0) 4535if (arguments.Arguments.Count < paramCount) 4540paramCount = arguments.Arguments.Count;
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (7)
792Debug.Assert(arguments.Arguments.Count > 0); 832Debug.Assert(arguments.Names.Count > badArg); 852Debug.Assert(arguments.Names.Count > badArg); 892Debug.Assert(arguments.Names.Count > badArg); 976var isWithElementValidation = arguments.Arguments.Count > 0 && !symbols.IsDefaultOrEmpty && symbols[0] is SynthesizedCollectionBuilderProjectedMethodSymbol; 987int argCount = arguments.Arguments.Count; 1589if (ResultsBuilder.Count == 0)
Binder\UnionMatchingRewriter.cs (1)
240Debug.Assert(binaryPatternStack.Count > 0);
Binder\WithUsingNamespacesAndTypesBinder.cs (5)
76Debug.Assert(members.Count == 0); 89var count = members.Count; 92if (members.Count != count) 100var count = members.Count; 103if (members.Count != count)
BoundTree\BoundNodeExtensions.cs (1)
152Debug.Assert(stack.Count == 0);
BoundTree\BoundTreeRewriter.cs (3)
284while (stack.Count > 0); 332while (stack.Count > 0); 377while (stack.Count > 0);
BoundTree\NullabilityRewriter.cs (4)
87Debug.Assert(stack.Count > 0); 131while (stack.Count > 0); 152Debug.Assert(stack.Count > 0); 168while (stack.Count > 0);
BoundTree\UnboundLambda.cs (3)
241int numExpressions = types.Count; 268int n = returns.Count; 1022returnType = (forErrorRecovery && returnTypes.Count == 0)
CodeGen\CodeGenerator.cs (5)
259int n = yieldPoints.Count; 318Debug.Assert(!(_expressionTemps?.Count > 0), "leaking expression temps?"); 449for (int i = sequencePoints.Count - 1; i >= 0; i--) 547if (_expressionTemps?.Count > 0) 550for (int i = _expressionTemps.Count - 1; i >= 0; i--)
CodeGen\EmitArrayInitializer.cs (1)
195Debug.Assert(indices.Count == arrayType.Rank - 1);
CodeGen\EmitExpression.cs (3)
1739while (calls.Count != 0) 3050int exprTempsBefore = _expressionTemps?.Count ?? 0; 3062var exprTempsAfter = _expressionTemps?.Count ?? 0;
CodeGen\EmitOperators.cs (1)
151while (stack.Count > 0);
CodeGen\EmitStatement.cs (6)
151Debug.Assert(_asyncYieldPoints.Count == _asyncResumePoints.Count); 159Debug.Assert(_asyncYieldPoints.Count == _asyncResumePoints.Count); 470else if (stack.Count == 0 && ReferenceEquals(destBox, top.destBox)) 484while (stack.Count != 0);
CodeGen\Optimizer.cs (9)
131var defs = ArrayBuilder<LocalDefUseSpan>.GetInstance(dummies.Count); 144var dummyCnt = defs.Count; 172var cnt = defs.Count; 547return _evalStack.Count; 562SetStackDepth(_evalStack.Count - 1); 1541if (stack.Count == 0) 1913if (defs.Count == 0) 1937var last = defs.Count - 1; 2165if (stack.Count == 0)
Compilation\CSharpCompilation.cs (11)
1413assemblies.EnsureCapacity(assemblies.Count + length); 2126if (viableEntryPoints.Count == 0) 2138else if (LanguageVersion >= MessageID.IDS_FeatureAsyncMain.RequiredVersion() && taskEntryPoints.Count > 0) 2160if (viableEntryPoints.Count == 0) 2185if (viableEntryPoints.Count == 0) 2208if (viableEntryPoints.Count > 1) 5136spine.RemoveAt(spine.Count - 1); 5159spine.RemoveAt(spine.Count - 1); 5164if (spine.Count == 0) 5169var symbol = GetCachedSymbol(spine[spine.Count - 1]); 5176for (var i = 1; i < spine.Count; i++)
Compilation\CSharpCompilation.UsingsFromOptionsAndDiagnostics.cs (1)
77if (boundUsings.Count == 0 && diagnostics is null)
Compilation\CSharpSemanticModel.cs (6)
4121if (symbols.Count == 0) 4560if (symbols.Count == 0) 4750Debug.Assert(members.Count > 0); 4757Debug.Assert((members.Count == 0) == (resultKind == LookupResultKind.Empty)); 4758Debug.Assert(members.Count == filteredMembers.Count);
Compilation\MemberSemanticModel.NodeMapBuilder.cs (1)
216while (stack.Count > 0)
Compiler\DocumentationCommentCompiler.cs (1)
484Debug.Assert(paramTags.Count > 0);
Compiler\MethodBodySynthesizer.Lowered.cs (1)
404Debug.Assert(fields.Count > 0);
Compiler\MethodCompiler.cs (4)
1829while (index >= awaiters.Count) 1840while (index >= hoistedVariables.Count) 1854while (awaiters.Count < previousAwaiterCount) 1860while (hoistedVariables.Count < previousAwaiterSlotCount)
Declarations\MergedNamespaceDeclaration.cs (2)
182Debug.Assert(namespaces.Count > 0); 209Debug.Assert(namespaces.Count > 0);
Emitter\Model\MostCommonNullableValueBuilder.cs (1)
88int n = builder.Count;
Emitter\Model\PEModuleBuilder.cs (15)
228while (namespacesAndTopLevelTypesToProcess.Count > 0) 256Debug.Assert(debugDocuments.Count == 0); 258Debug.Assert(typesToProcess.Count == 0); 283if (debugDocuments.Count > 0) 313while (typesToProcess.Count > 0) 592index = builder.Count; 826Debug.Assert(stack.Count == 0); 829while (stack.Count > 0) 856int index = builder.Count; 872for (int i = groupingTypes.Count - 1; i >= 0; i--) 889int groupingIndex = builder.Count; 906int groupingIndex = builder.Count; 943int currentStackSize = stack.Count; 947while (stack.Count > currentStackSize) 1819if (builder.Count == 1 && builder[0])
FlowAnalysis\AbstractFlowPass.cs (5)
2462Debug.Assert(stack.Count > 0); 2516if (stack.Count == 0) 2628if (stack.Count == 0) 2646if (stack.Count == 0) 2728Debug.Assert(parts.Count >= 2);
FlowAnalysis\AbstractFlowPass.PendingBranchesCollection.cs (1)
65if (_unlabeledBranches.Count == 0)
FlowAnalysis\AlwaysAssignedWalker.cs (1)
57if (i >= variableBySlot.Count)
FlowAnalysis\ControlFlowPass.cs (1)
421var initialUsingCount = _usingDeclarations.Count;
FlowAnalysis\DefiniteAssignment.cs (4)
277int slot = variableBySlot.Count; 997int n = variableBySlot.Count; 1165_alreadyReported.EnsureCapacity(variableBySlot.Count); 1836var result = new LocalState(BitVector.AllSet(variableBySlot.Count));
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (2)
32new LocalState(BitVector.AllSet(variableBySlot.Count), normalizeToBottom: true), 128int n = variableBySlot.Count;
FlowAnalysis\DefinitelyAssignedWalker.cs (1)
93if (slot < variableBySlot.Count &&
FlowAnalysis\NullableWalker.cs (15)
3313var unvisitedLocalFuncs = localFuncs.Count; 3324for (int i = 0; unvisitedLocalFuncs != 0 && i < localFuncs.Count; i++) 3349for (int i = 0; i < localFuncs.Count; i++) 5111int n = expressions.Count; 5263int n = returns.Count; 5475if (stack.Count == 0) 5495if (stack.Count == 0) 5882if (slotBuilder.Count != 0) 7888Debug.Assert(argumentsBuilder.Count == arguments.Length + elements.Length - 1); 10406if (previousArgumentConversionResults.Count > placeholder.ArgumentIndex) 10424if (placeholder.ArgumentIndex < previousArgumentConversionResults.Count && placeholder.ArgumentIndex is >= 0 or BoundInterpolatedStringArgumentPlaceholder.ExtensionReceiver) 11476int n = variables.Count; 11562int n = variables.Count; 12950Debug.Assert(stack.Count > 0); 12985if (stack.Count == 0)
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
172Debug.Assert(_symbolToSlot.Count == _walkerStates.Count);
FlowAnalysis\NullableWalker.Variables.cs (3)
166Debug.Assert(_variableBySlot.Count == 1); 319internal int NextAvailableIndex => _variableBySlot.Count; 332for (index++; index < variableBySlot.Count; index++)
Lowering\AsyncRewriter\RuntimeAsyncRewriter.cs (1)
55else if (hoistedLocals.Count > 0)
Lowering\ClosureConversion\ClosureConversion.Analysis.cs (2)
148if (function.CapturedEnvironments.Count > 0) 555closureId = new DebugId(closureDebugInfo.Count, _compilationState.ModuleBuilderOpt.CurrentGenerationOrdinal);
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (1)
407Debug.Assert(_labelsInScope.Count == 1);
Lowering\ClosureConversion\ClosureConversion.cs (7)
449else if ((nestedFunction.CapturedEnvironments.Count == 0 && 930var refkindsBuilder = ArrayBuilder<RefKind>.GetInstance(argumentsBuilder.Count); 1185if (prologue.Count > 0) 1257if (prologue.Count > 0) 1267else if (prologue.Count > 0) 1270var prologueBuilder = ArrayBuilder<BoundStatement>.GetInstance(prologue.Count); 1511lambdaId = new DebugId(_lambdaDebugInfoBuilder.Count, CompilationState.ModuleBuilderOpt.CurrentGenerationOrdinal);
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (2)
207if (fileIndices.Count == 1) 506int spansIndex = _spansBuilder.Count;
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (1)
107if (_lazyPreviousContextVariables is { Count: > 0 })
Lowering\LocalRewriter\LocalRewriter_AssignmentOperator.cs (1)
367Debug.Assert(receiverIsKnownToBeCaptured || storesOpt.Count != 0);
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (3)
147Debug.Assert(stack.Count >= 1); 155while (stack.Count > 0) 160applyParentUnaryOperator: (stack.Count == 0) ? applyParentUnaryOperator : null);
Lowering\LocalRewriter\LocalRewriter_Call.cs (9)
173var netArity = typeArgumentsBuilder.Count; 793Debug.Assert(saveTempsOpt is object || tempsOpt?.Count is null or > 0); 1411Debug.Assert(refKinds.Count == arguments.Length); 1412Debug.Assert(storesToTemps.Count == 0); 1547if (storesToTemps.Count > 0) 1575int tempsRemainedInUse = tempStores.Count; 1613Debug.Assert(firstUnclaimedStore == tempStores.Count, "not all side-effects were claimed"); 1626for (int i = firstUnclaimedStore; i < tempStores.Count; i++) 1695Debug.Assert(argsRefKindsBuilder.Count == parameters.Length);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (1)
1443Debug.Assert(rewrittenExpressions.Count >= numberIncludingLastSpread);
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (2)
166BoundExpression result = (temps.Count == 0 && stores.Count == 0) ?
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (3)
151length = builder.Count; 158ImmutableArray.Create<BoundExpression>(_factory.Literal(builder.Count)), 174while (stack.Count != 0)
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (5)
224Debug.Assert(leftTargets.Count == rightParts.Length && leftTargets.Count == deconstructConversionInfo.Length); 226var builder = isUsed ? ArrayBuilder<BoundExpression>.GetInstance(leftTargets.Count) : null; 227for (int i = 0; i < leftTargets.Count; i++) 505if (init.Count == 0)
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (1)
53Debug.Assert(statementBuilder.Count == numFixedLocals + 1 + 1);
Lowering\LocalRewriter\LocalRewriter_FunctionPointerInvocation.cs (1)
54if (temps.Count == 0)
Lowering\LocalRewriter\LocalRewriter_IfStatement.cs (1)
43stack.Push((node, afterif, builder.Count));
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (2)
222if (temps.Count == 0) 330if (sideEffectsBuilder.Count != 0)
Lowering\LocalRewriter\LocalRewriter_IsPatternOperator.cs (5)
124if (_statements.Count != 0) 179if (_sideEffectBuilder.Count != 0) 302if (_sideEffectBuilder.Count > 0 || _conjunctBuilder.Count == 0) 307Debug.Assert(_sideEffectBuilder.Count == 0);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingAssignmentOperator.cs (2)
63if (temps.Count == 0 && stores.Count == 0)
Lowering\LocalRewriter\LocalRewriter_ObjectCreationExpression.cs (2)
280int dynamicSiteCount = dynamicSiteInitializers?.Count ?? 0; 281var sideEffects = ArrayBuilder<BoundExpression>.GetInstance(1 + dynamicSiteCount + loweredInitializers.Count);
Lowering\LocalRewriter\LocalRewriter_PatternSwitchStatement.cs (1)
114if (result.Count == 0)
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (13)
132switch (concatKind, visitedArguments.Count) 145var concatMember = visitedArguments.Count switch 172concatMember = visitedArguments.Count switch 178_ => throw ExceptionUtilities.UnexpectedValue(visitedArguments.Count), 181for (int i = 0; i < visitedArguments.Count; i++) 222var followingArgument = destinationArguments.Count > 0 ? destinationArguments[^1] : null; 226Debug.Assert((destinationArguments.Count == 0 && followingArgument is null) || (destinationArguments.Count != 0 && ReferenceEquals(followingArgument, destinationArguments[^1]))); 363var followingArgument = finalArguments.Count > 0 ? finalArguments[^1] : null; 380Debug.Assert((finalArguments.Count == 0 && followingArgument is null) || (finalArguments.Count != 0 && ReferenceEquals(followingArgument, finalArguments[^1]))); 518for (int i = 0; i < args.Count; i++) 596Debug.Assert(stack.Count > 0);
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (1)
124else if (appendShouldProceedLocal is not null && resultExpressions.Count > 0)
Lowering\LocalRewriter\LocalRewriter_TupleCreationExpression.cs (4)
55underlyingTupleTypeChain.Count * (NamedTypeSymbol.ValueTupleRestPosition - 1), 71if (underlyingTupleTypeChain.Count > 0) 89(underlyingTupleTypeChain.Count - 1) * (NamedTypeSymbol.ValueTupleRestPosition - 1), 96while (underlyingTupleTypeChain.Count > 0);
Lowering\LocalRewriter\LocalRewriter.cs (4)
735if (statement is null || previousLocals is { } || _additionalLocals!.Count == 0) 774for (int i = 0; i < statements.Count; i++) 790if (optimizedInitializers == statements.Count) 800for (int i = 0; i < statements.Count; i++)
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (2)
1096Debug.Assert(whenNodes.Count > 1); 1149&& whenExpressionInfo.WhenNodes.Count > 1;
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (1)
160for (int i = 0; i < variableBySlot.Count; i++)
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (5)
384if (variableCleanup.Count != 0) 394if (hoistedLocalsWithDebugScopes.Count != 0) 469if (_lazyAvailableReusableHoistedFields != null && _lazyAvailableReusableHoistedFields.TryGetValue(type, out fields) && fields.Count > 0) 565if (hoistedLocalsWithDebugScopes.Count != 0) 569if (newLocalsBuilder.Count == 0)
Lowering\StateMachineRewriter\RefInitializationHoister.cs (1)
102if (sideEffects.Count == 0)
Lowering\SyntheticBoundNodeFactory.cs (1)
1047if (locals.IsDefaultOrEmpty && builder.Count == 0)
Operations\CSharpOperationFactory.cs (2)
1539Debug.Assert(stack.Count > 0); 1554Debug.Assert(left is not null && stack.Count == 0);
Parser\LanguageParser_InterpolatedString.cs (4)
69Debug.Assert(diagnosticsBuilder.Count > 0); 172Debug.Assert(isInterpolatedString || interpolations.Count == 0, "Non-interpolated parsing should never produce interpolations"); 199for (var i = 0; i < interpolations.Count; i++) 222indentationWhitespace, content, isFirst: interpolations.Count == 0, isLast: true,
Parser\LanguageParser.cs (2)
11774while (stack.Count > 0) 14740while (stack.Count > 0)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (1)
800(!Format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.ExcludeParameterNameIfStandalone) && Builder.Count == 0));
Symbols\AbstractTypeMap.cs (2)
166Debug.Assert(builder.Count == customModifiers.Length); 374map.Add(substituted.Type, result.Count);
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (3)
494if (anonymousTypes.Count > 0 && !ReportMissingOrErroneousSymbols(diagnostics)) 507if (anonymousDelegatesWithIndexedNames.Count > 0 || anonymousDelegates.Count > 0)
Symbols\AssemblySymbol.cs (1)
829int i = nestedTypes.Count - 1;
Symbols\Compilation_UsedAssemblies.cs (1)
156while (stack.Count != 0)
Symbols\Extensions\SourceExtensionImplementationMethodSymbol.cs (1)
135Debug.Assert(parameters.Count == ParameterCount);
Symbols\Metadata\PE\NativeIntegerTypeDecoder.cs (1)
133for (int i = 0; i < allTypeArguments.Count; i++)
Symbols\Metadata\PE\PENamedTypeSymbol.cs (7)
1485count += eventFields.Count; 1504Debug.Assert(result.Count == count); 1841int membersCount = members.Count; 1871int originalCount = members.Count; 1874membersCount += members.Count; // account for added tuple error fields 2701if (symbols.Count == 0) 3339for (int i = 0; i < ownedParams.Count; i++)
Symbols\Metadata\PE\PETypeParameterSymbol.cs (1)
199if (symbolsBuilder.Count == 0)
Symbols\MetadataOrSourceOrRetargetingAssemblySymbol.cs (1)
89while (!found && queue.Count != 0)
Symbols\NamedTypeSymbol.cs (2)
1174for (int i = 0; i < allTypeArguments.Count; i++) 1207for (int i = 0; i < allTypeArguments.Count; i++)
Symbols\ReducedExtensionMethodSymbol.cs (1)
215if (useSiteDiagnosticsBuilder != null && useSiteDiagnosticsBuilder.Count > 0)
Symbols\ReferenceManager.cs (2)
598if (linkedReferencedAssembliesBuilder.Count > 0) 1128Debug.Assert(result.Count == builderSize);
Symbols\Retargeting\RetargetingSymbolTranslator.cs (9)
524startOfNonInterfaceArguments = oldArguments.Count; 534var newArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance(oldArguments.Count); 565ArrayBuilder<TypeParameterSymbol> newParameters = ArrayBuilder<TypeParameterSymbol>.GetInstance(newArguments.Count); 578Debug.Assert(newParameters.Count == newArguments.Count); 601for (int i = startOfNonInterfaceArguments; i < oldArguments.Count; i++) 614for (int i = startOfNonInterfaceArguments; i < oldArguments.Count; i++) 627for (int i = startOfNonInterfaceArguments; i < newArguments.Count; i++) 741Debug.Assert(newModifiers == null || newModifiers.Count == oldModifiers.Length);
Symbols\Source\ConstantEvaluationHelpers.cs (4)
57Debug.Assert(order.Count == 0); 108while (pending.Count > 0) 183if (set.Count > 0) 302while (stack.Count > 0)
Symbols\Source\CustomModifierUtils.cs (1)
103int length = flagsBuilder.Count;
Symbols\Source\SourceAssemblySymbol.cs (2)
139moduleBuilder.Add(new PEModuleSymbol(this, netModule, importOptions, moduleBuilder.Count)); 1083for (int i = 0; i < topLevelTypesFromModules.Count - 1; i++)
Symbols\Source\SourceMemberContainerSymbol.cs (25)
1486return symbols.Count > 0 ? 3522Debug.Assert(InstanceInitializersForPositionalMembers.Count != 0); 3559Debug.Assert(insertedInitializers[insertedInitializers.Count - 1].Syntax.SyntaxTree == declaredInitializers[0].Syntax.SyntaxTree); 3560Debug.Assert(insertedInitializers[insertedInitializers.Count - 1].Syntax.Span.Start < declaredInitializers[0].Syntax.Span.Start); 3569Debug.Assert(groupsBuilder.Count == groupCount); 3579Debug.Assert(groupsBuilder.Count == groupCount + 1); 3641if (initializers.Count == 0) 3647var builder = ArrayBuilder<ImmutableArray<FieldOrPropertyInitializer>>.GetInstance(initializers.Count); 4533for (int i = 0; i < symbols.Count; i++) 4741else if (initializers.Count != 0) 5038int memberOffset = members.Count + typesBuilder.Count; // In order to keep the same relative order between constructors during emit we assign offset in decreasing order 5058Debug.Assert(memberOffset == members.Count - typesBuilder.Count); 5198members.Add(new SynthesizedRecordDeconstruct(this, ctor, positionalMembers, memberOffset: members.Count)); 5246var copyCtor = new SynthesizedRecordCopyCtor(this, memberOffset: members.Count); 5272members.Add(new SynthesizedRecordClone(this, memberOffset: members.Count)); 5299printMembersMethod = new SynthesizedRecordPrintMembers(this, userDefinedMembers, memberOffset: members.Count); 5373memberOffset: members.Count); 5506members.Add(new SynthesizedRecordObjEquals(this, thisEquals, memberOffset: members.Count)); 5529getHashCode = new SynthesizedRecordGetHashCode(this, equalityContract, memberOffset: members.Count); 5628thisEquals = new SynthesizedRecordEquals(this, equalityContract, memberOffset: members.Count); 5670members.Add(new SynthesizedRecordBaseEquals(this, memberOffset: members.Count)); 5676members.Add(new SynthesizedRecordEqualityOperator(this, memberOffset: members.Count, diagnostics)); 5677members.Add(new SynthesizedRecordInequalityOperator(this, memberOffset: members.Count, diagnostics));
Symbols\Source\SourceMethodSymbolWithAttributes.cs (4)
1134if (namespaceSegments.Length > thisNamespaceNames.Count) 1152if (namespaceNames.Count == 0) 1334if (namespaceSegments.Length > thisNamespaceNames.Count) 1352if (namespaceNames.Count == 0)
Symbols\Source\SourceModuleSymbol.cs (1)
402while (toVisit.Count > 0)
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (1)
677if (this.SpecialType == SpecialType.System_Object && ((object)localBase != null || localInterfaces.Count != 0))
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (4)
138for (int i = 0; i < typeConstraintStrings.Count; i++) 244if (typeArguments.Count > 0) 247for (int i = 0; i < typeArguments.Count; i++) 806for (int i = 0; i < attributesBuilder.Count; i++)
Symbols\Source\SourceNamedTypeSymbol.cs (1)
541Debug.Assert(originalConstraintTypes.Length == mergedConstraintTypes.Count);
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (1)
323if (mergedNamespacesOrTypes.Count == 0)
Symbols\Source\SourceOrdinaryMethodSymbol.cs (1)
1219for (int i = 0; i < result.Count; i++)
Symbols\Source\SourcePropertyAccessorSymbol.cs (1)
830parameters.Add(new SynthesizedPropertyAccessorValueParameterSymbol(this, parameters.Count));
Symbols\SubstitutedTypeParameterSymbol.cs (2)
114for (int i = constraintTypes.Count - 1; i >= 0; i--) 129if (constraintTypes.Count == 0)
Symbols\Symbol_Attributes.cs (1)
489if (builder.Count != 0)
Symbols\Synthesized\Records\SynthesizedRecordEquals.cs (1)
158if (fields.Count > 0 && !foundBadField)
Symbols\Synthesized\SynthesizedDelegateSymbol.cs (1)
65(Method: this, ParameterCount: parameterDescriptions.Count));
Symbols\Tuples\TupleTypeSymbol.cs (1)
730for (int i = 0; i < elementsMatchedByFields.Count; i++)
Symbols\TypeSymbol.cs (5)
1288for (int i = 0; i < implementations.Count; i++) 1304Debug.Assert(implementations.Count == 1); 1322if (implementations.Count != 0) 1326for (int i = implementations.Count - 1; i >= 0; i--) 1345switch (implementations.Count)
Symbols\TypeSymbolExtensions.cs (1)
2057for (int i = 0; i < typeArgumentsBuilder.Count; i++)
Syntax\CSharpPragmaWarningStateMap.cs (2)
82var entries = new WarningStateMapEntry[directiveList.Count + 1]; 94while (index < directiveList.Count)
Syntax\SyntaxExtensions.cs (1)
407while (stack.Count > 0)
Syntax\SyntaxFacts.cs (1)
580while (stack.Count > 0)
Syntax\SyntaxNormalizer.cs (8)
177for (int i = _indentations.Count; i <= count; i++) 1058(currentTriviaList.Count > 0 && NeedsSeparatorBetween(currentTriviaList.Last())) || 1059(currentTriviaList.Count == 0 && isTrailing); 1062|| (currentTriviaList.Count > 0 && NeedsLineBreakBetween(currentTriviaList.Last(), trivia, isTrailing)); 1102&& (currentTriviaList.Count == 0 || !EndsInLineBreak(currentTriviaList.Last()))) 1112if (currentTriviaList.Count > 0 1137if (currentTriviaList.Count == 0) 1141else if (currentTriviaList.Count == 1)
Utilities\ValueSetFactory.NumericValueSet.cs (2)
214Debug.Assert(builder.Count == 0 || tc.Related(LessThanOrEqual, builder.Last().first, first)); 215if (builder.Count > 0 && (tc.Related(Equal, tc.MinValue, first) || tc.Related(GreaterThanOrEqual, builder.Last().last, tc.Prev(first))))
Microsoft.CodeAnalysis.Scripting (4)
Hosting\ObjectFormatter\CommonTypeNameFormatter.cs (1)
260for (int i = nestedTypes.Count - 1; i >= 0; i--)
Script.cs (2)
433var executors = ArrayBuilder<Func<object[], Task>>.GetInstance(scriptsReversed.Count); 437for (int i = scriptsReversed.Count - 1; i >= 0; i--)
Utilities\ParameterValidationHelpers.cs (1)
61throw new ArgumentNullException($"{parameterName}[{builder.Count}]");