328 implementations of Count
Aspire.RabbitMQ.Client (1)
src\Components\Aspire.RabbitMQ.Client\RabbitMQEventSourceLogForwarder.cs (1)
76public int Count { get; }
ConfigurationSchemaGenerator (1)
RuntimeSource\SourceGenerators\ImmutableEquatableArray.cs (1)
22public int Count => _values.Length;
Microsoft.AspNetCore.Components (3)
ResourceAssetCollection.cs (1)
68int IReadOnlyCollection<ResourceAsset>.Count => _resources.Count;
src\Http\Http.Abstractions\src\Routing\RouteValueDictionary.cs (1)
312public int Count => _count;
src\Http\Routing\src\PathTokenizer.cs (1)
28public int Count
Microsoft.AspNetCore.Components.Endpoints (1)
Rendering\EndpointHtmlRenderer.cs (1)
249public int Count => _form.Count;
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.AspNetCore.Hosting (4)
Internal\HostingApplicationDiagnostics.cs (1)
497public int Count => 2;
Internal\HostingRequestFinishedLog.cs (1)
22public int Count => 12;
Internal\HostingRequestStartingLog.cs (1)
21public int Count => 10;
Internal\HostingRequestUnhandledLog.cs (1)
19public int Count => 7;
Microsoft.AspNetCore.Http (1)
src\Shared\Dictionary\AdaptiveCapacityDictionary.cs (1)
144public int Count => _dictionaryStorage != null ? _dictionaryStorage.Count : _count;
Microsoft.AspNetCore.Http.Abstractions (2)
Routing\EndpointMetadataCollection.cs (1)
63public int Count => _items.Length;
Routing\RouteValueDictionary.cs (1)
312public int Count => _count;
Microsoft.AspNetCore.Http.Connections (1)
Internal\ConnectionLogScope.cs (1)
33public int Count => string.IsNullOrEmpty(ConnectionId) ? 0 : 1;
Microsoft.AspNetCore.Http.Connections.Client (1)
Internal\ConnectionLogScope.cs (1)
41public int Count => string.IsNullOrEmpty(ConnectionId) ? 0 : 1;
Microsoft.AspNetCore.HttpLogging (1)
HttpLog.cs (1)
25public int Count => _keyValues.Count;
Microsoft.AspNetCore.Mvc.Abstractions (2)
ModelBinding\ModelStateDictionary.cs (1)
137public int Count { get; private set; }
ModelBinding\Validation\ValidationStateDictionary.cs (1)
55public int Count => _inner.Count;
Microsoft.AspNetCore.Mvc.Core (2)
Diagnostics\EventData.cs (1)
26int IReadOnlyCollection<KeyValuePair<string, object>>.Count => Count;
MvcCoreLoggerExtensions.cs (1)
307public int Count => 2;
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
AttributeDictionary.cs (1)
57public int Count => _items == null ? 0 : _items.Count;
ViewComponents\DefaultViewComponentInvoker.cs (1)
309public int Count => 2;
Microsoft.AspNetCore.Routing (1)
PathTokenizer.cs (1)
28public int Count
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Internal\ConnectionLogScope.cs (1)
33public int Count => 1;
Microsoft.AspNetCore.Shared.Tests (1)
src\Shared\Dictionary\AdaptiveCapacityDictionary.cs (1)
144public int Count => _dictionaryStorage != null ? _dictionaryStorage.Count : _count;
Microsoft.AspNetCore.SignalR.Client.Core (1)
Internal\ConnectionLogScope.cs (1)
42public int Count => string.IsNullOrEmpty(ConnectionId) ? 0 : 1;
Microsoft.AspNetCore.SignalR.Core (1)
Internal\HubGroupList.cs (1)
45public int Count => _groups.Count;
Microsoft.Build (4)
BackEnd\BuildManager\GlobalPropertiesLookup.cs (1)
42public int Count => _backingProperties.Count;
Collections\ArrayDictionary.cs (1)
84public int Count => count;
Instance\ImmutableProjectCollections\ImmutableStringValuedListConverter.cs (1)
29public int Count => _itemList.Count;
ReadOnlyEmptyDictionary.cs (1)
57public int Count
Microsoft.Build.Framework (14)
ImmutableSegmentedDictionary`2.cs (1)
84public int Count => _dictionary.Count;
ImmutableSegmentedDictionary`2+Builder.cs (1)
54public int Count => ReadOnlyDictionary.Count;
ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
26public int Count => _dictionary.Count;
ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
26public int Count => _dictionary.Count;
ImmutableSegmentedDictionary`2+KeyCollection.cs (1)
22public int Count => _dictionary.Count;
ImmutableSegmentedDictionary`2+ValueCollection.cs (1)
22public int Count => _dictionary.Count;
ImmutableSegmentedList`1.cs (1)
81public int Count => _list.Count;
ImmutableSegmentedList`1+Builder.cs (1)
24public int Count => _builder.Count;
ImmutableSegmentedList`1+ValueBuilder.cs (1)
33public int Count => ReadOnlyList.Count;
SegmentedArray`1.cs (1)
129int IReadOnlyCollection<T>.Count => Length;
SegmentedDictionary`2.cs (3)
165public int Count => _count - _freeCount; 1301public int Count => _dictionary.Count; 1501public int Count => _dictionary.Count;
SegmentedList`1.cs (1)
152public int Count => _size;
Microsoft.Build.Tasks.Core (1)
ReadOnlyEmptyDictionary.cs (1)
57public int Count
Microsoft.Build.Utilities.Core (1)
ReadOnlyEmptyDictionary.cs (1)
57public int Count
Microsoft.CodeAnalysis (32)
Collections\OrderedSet.cs (1)
47public int Count
InternalUtilities\SetWithInsertionOrder.cs (1)
85public int Count => _elements?.Count ?? 0;
InternalUtilities\SpecializedCollections.Singleton.Collection`1.cs (1)
44public int Count => 1;
Operations\IOperation.OperationList.cs (1)
32public int Count => _operation.ChildOperationsCount;
Operations\IOperation.OperationList.Reversed.cs (1)
34public int Count => _operation.ChildOperationsCount;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2.cs (1)
84public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder.cs (1)
31public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
26public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
26public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+KeyCollection.cs (1)
22public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueBuilder.cs (1)
56public readonly int Count => ReadOnlyDictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueCollection.cs (1)
22public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1.cs (1)
80public int Count => _set.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+Builder.cs (1)
32public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
54public readonly int Count => ReadOnlySet.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1.cs (1)
81public int Count => _list.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1+Builder.cs (1)
24public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1+ValueBuilder.cs (1)
33public readonly int Count => ReadOnlyList.Count;
src\Dependencies\Collections\SegmentedArray`1.cs (1)
126int IReadOnlyCollection<T>.Count => Length;
src\Dependencies\Collections\SegmentedDictionary`2.cs (3)
228public int Count => _count - _freeCount; 1337public int Count => _dictionary.Count; 1545public int Count => _dictionary.Count;
src\Dependencies\Collections\SegmentedHashSet`1.cs (1)
356public int Count => _count - _freeCount;
src\Dependencies\Collections\SegmentedList`1.cs (1)
179public int Count => _size;
src\Dependencies\PooledObjects\ArrayBuilder.cs (1)
104public int Count
Syntax\ChildSyntaxList.cs (1)
28public int Count
Syntax\SeparatedSyntaxList.cs (1)
95public int Count
Syntax\SyntaxList`1.cs (1)
108public int Count
Syntax\SyntaxNodeOrTokenList.cs (1)
123public int Count
Syntax\SyntaxTokenList.cs (1)
116public int Count => Node == null ? 0 : (Node.IsList ? Node.SlotCount : 1);
Syntax\SyntaxTriviaList.cs (1)
106public int Count
Text\TextLineCollection.cs (1)
21public abstract int Count { get; }
Microsoft.CodeAnalysis.CodeStyle (22)
src\Compilers\Core\Portable\InternalUtilities\SetWithInsertionOrder.cs (1)
85public int Count => _elements?.Count ?? 0;
src\Compilers\Core\Portable\InternalUtilities\SpecializedCollections.Singleton.Collection`1.cs (1)
44public int Count => 1;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2.cs (1)
84public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder.cs (1)
31public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
26public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
26public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+KeyCollection.cs (1)
22public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueBuilder.cs (1)
56public readonly int Count => ReadOnlyDictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueCollection.cs (1)
22public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1.cs (1)
80public int Count => _set.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+Builder.cs (1)
32public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
54public readonly int Count => ReadOnlySet.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1.cs (1)
81public int Count => _list.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1+Builder.cs (1)
24public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1+ValueBuilder.cs (1)
33public readonly int Count => ReadOnlyList.Count;
src\Dependencies\Collections\SegmentedArray`1.cs (1)
126int IReadOnlyCollection<T>.Count => Length;
src\Dependencies\Collections\SegmentedDictionary`2.cs (3)
228public int Count => _count - _freeCount; 1337public int Count => _dictionary.Count; 1545public int Count => _dictionary.Count;
src\Dependencies\Collections\SegmentedHashSet`1.cs (1)
356public int Count => _count - _freeCount;
src\Dependencies\Collections\SegmentedList`1.cs (1)
179public int Count => _size;
src\Dependencies\PooledObjects\ArrayBuilder.cs (1)
104public int Count
Microsoft.CodeAnalysis.Collections.Package (19)
ImmutableSegmentedDictionary`2.cs (1)
84public int Count => _dictionary.Count;
ImmutableSegmentedDictionary`2+Builder.cs (1)
31public int Count => _builder.Count;
ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
26public int Count => _dictionary.Count;
ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
26public int Count => _dictionary.Count;
ImmutableSegmentedDictionary`2+KeyCollection.cs (1)
22public int Count => _dictionary.Count;
ImmutableSegmentedDictionary`2+ValueBuilder.cs (1)
56public readonly int Count => ReadOnlyDictionary.Count;
ImmutableSegmentedDictionary`2+ValueCollection.cs (1)
22public int Count => _dictionary.Count;
ImmutableSegmentedHashSet`1.cs (1)
80public int Count => _set.Count;
ImmutableSegmentedHashSet`1+Builder.cs (1)
32public int Count => _builder.Count;
ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
54public readonly int Count => ReadOnlySet.Count;
ImmutableSegmentedList`1.cs (1)
81public int Count => _list.Count;
ImmutableSegmentedList`1+Builder.cs (1)
24public int Count => _builder.Count;
ImmutableSegmentedList`1+ValueBuilder.cs (1)
33public readonly int Count => ReadOnlyList.Count;
SegmentedArray`1.cs (1)
126int IReadOnlyCollection<T>.Count => Length;
SegmentedDictionary`2.cs (3)
228public int Count => _count - _freeCount; 1337public int Count => _dictionary.Count; 1545public int Count => _dictionary.Count;
SegmentedHashSet`1.cs (1)
356public int Count => _count - _freeCount;
SegmentedList`1.cs (1)
179public int Count => _size;
Microsoft.CodeAnalysis.InteractiveHost (1)
src\Dependencies\PooledObjects\ArrayBuilder.cs (1)
104public int Count
Microsoft.CodeAnalysis.PooledObjects.Package (1)
ArrayBuilder.cs (1)
104public int Count
Microsoft.CodeAnalysis.UnitTests (1)
Collections\EnumerableExtensionsTests.cs (1)
41public int Count => _items.Length;
Microsoft.CodeAnalysis.Workspaces (22)
src\Compilers\Core\Portable\InternalUtilities\SetWithInsertionOrder.cs (1)
85public int Count => _elements?.Count ?? 0;
src\Compilers\Core\Portable\InternalUtilities\SpecializedCollections.Singleton.Collection`1.cs (1)
44public int Count => 1;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2.cs (1)
84public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder.cs (1)
31public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
26public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
26public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+KeyCollection.cs (1)
22public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueBuilder.cs (1)
56public readonly int Count => ReadOnlyDictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueCollection.cs (1)
22public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1.cs (1)
80public int Count => _set.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+Builder.cs (1)
32public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
54public readonly int Count => ReadOnlySet.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1.cs (1)
81public int Count => _list.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1+Builder.cs (1)
24public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1+ValueBuilder.cs (1)
33public readonly int Count => ReadOnlyList.Count;
src\Dependencies\Collections\SegmentedArray`1.cs (1)
126int IReadOnlyCollection<T>.Count => Length;
src\Dependencies\Collections\SegmentedDictionary`2.cs (3)
228public int Count => _count - _freeCount; 1337public int Count => _dictionary.Count; 1545public int Count => _dictionary.Count;
src\Dependencies\Collections\SegmentedHashSet`1.cs (1)
356public int Count => _count - _freeCount;
src\Dependencies\Collections\SegmentedList`1.cs (1)
179public int Count => _size;
src\Dependencies\PooledObjects\ArrayBuilder.cs (1)
104public int Count
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (22)
src\Compilers\Core\Portable\InternalUtilities\SetWithInsertionOrder.cs (1)
85public int Count => _elements?.Count ?? 0;
src\Compilers\Core\Portable\InternalUtilities\SpecializedCollections.Singleton.Collection`1.cs (1)
44public int Count => 1;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2.cs (1)
84public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder.cs (1)
31public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
26public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
26public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+KeyCollection.cs (1)
22public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueBuilder.cs (1)
56public readonly int Count => ReadOnlyDictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueCollection.cs (1)
22public int Count => _dictionary.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1.cs (1)
80public int Count => _set.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+Builder.cs (1)
32public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
54public readonly int Count => ReadOnlySet.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1.cs (1)
81public int Count => _list.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1+Builder.cs (1)
24public int Count => _builder.Count;
src\Dependencies\Collections\ImmutableSegmentedList`1+ValueBuilder.cs (1)
33public readonly int Count => ReadOnlyList.Count;
src\Dependencies\Collections\SegmentedArray`1.cs (1)
126int IReadOnlyCollection<T>.Count => Length;
src\Dependencies\Collections\SegmentedDictionary`2.cs (3)
228public int Count => _count - _freeCount; 1337public int Count => _dictionary.Count; 1545public int Count => _dictionary.Count;
src\Dependencies\Collections\SegmentedHashSet`1.cs (1)
356public int Count => _count - _freeCount;
src\Dependencies\Collections\SegmentedList`1.cs (1)
179public int Count => _size;
src\Dependencies\PooledObjects\ArrayBuilder.cs (1)
104public int Count
Microsoft.DotNet.XUnitAssert.Tests (1)
Utility\ReadOnlySet.cs (1)
15 public int Count => hashSet.Count;
Microsoft.Extensions.AI (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Extensions.AI.Abstractions (4)
AdditionalPropertiesDictionary{TValue}.cs (1)
77public int Count => _dictionary.Count;
Embeddings\GeneratedEmbeddings.cs (1)
56public int Count => _embeddings.Count;
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Extensions.AI.Abstractions.Tests (1)
test\Shared\JsonSchemaExporter\TestTypes.cs (1)
1108public int Count => 1;
Microsoft.Extensions.AI.AzureAIInference (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Extensions.AI.Ollama (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Extensions.AI.OpenAI (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Extensions.Diagnostics.HealthChecks (2)
DefaultHealthCheckService.cs (1)
301public int Count => _values.Count;
HealthCheckLogScope.cs (1)
14int IReadOnlyCollection<KeyValuePair<string, object>>.Count { get; } = 1;
Microsoft.Extensions.Http (1)
Logging\HttpHeadersLogValue.cs (1)
74public int Count => Values.Count;
Microsoft.Extensions.Http.Diagnostics (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Extensions.Logging (1)
LoggerFactoryScopeProvider.cs (1)
171public int Count { get; }
Microsoft.Extensions.Logging.Abstractions (8)
FormattedLogValues.cs (1)
78public int Count
LoggerMessage.cs (7)
489public int Count => 1; 533public int Count => 2; 585public int Count => 3; 612public int Count => 4; 668public int Count => 5; 730public int Count => 6; 796public int Count => 7;
Microsoft.Extensions.Primitives (1)
StringValues.cs (1)
91public int Count
Microsoft.Extensions.Telemetry (3)
Logging\ExtendedLogger.LegacyTagJoiner.cs (1)
68public int Count => _incomingTagCount + _extraTags.Count + StaticTags!.Length;
Logging\ExtendedLogger.ModernTagJoiner.cs (1)
78public int Count => _incomingTagsCount + _redactedTagsCount + _extraTags.Count + StaticTags!.Length;
Logging\Import\LoggerFactoryScopeProvider.cs (1)
187public int Count { get; }
Microsoft.Extensions.Telemetry.Abstractions (1)
Logging\LoggerMessageState.ReadOnlyList.cs (1)
16int IReadOnlyCollection<KeyValuePair<string, object?>>.Count => TagsCount;
Microsoft.Gen.ComplianceReports.Unit.Tests (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Gen.ContextualOptions.Unit.Tests (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Gen.Logging.Unit.Tests (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Gen.MetadataExtractor.Unit.Tests (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Gen.Metrics.Unit.Tests (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Gen.MetricsReports.Unit.Tests (2)
src\Shared\EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
src\Shared\EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Microsoft.Maui (2)
Primitives\ItemDelegateList.cs (1)
15 public int Count => ItemDelegate.GetCount();
Primitives\LockableObservableListWrapper.cs (1)
46 public int Count
Microsoft.Maui.Controls (7)
DragAndDrop\DataPackagePropertySetView.cs (1)
29 public int Count => _dataPackagePropertySet.Count;
ListProxy.cs (1)
112 public int Count
ReadOnlyCastingList.cs (2)
28 public int Count 58 public int Count
SynchronizedList.cs (1)
44 public int Count
TemplatedItemsList.cs (2)
338 public int Count 1271 public int Count
Microsoft.ML.Core (1)
Data\IEstimator.cs (1)
24public int Count => _columns.Count();
Microsoft.ML.Data (1)
Transforms\Normalizer.cs (1)
496public int Count => _infos.Length;
Microsoft.ML.DataView (1)
DataViewSchema.cs (1)
27public int Count => _columns.Length;
Microsoft.ML.StandardTrainers (1)
Standard\LinearModelParameters.cs (1)
67public int Count => _pred.Weight.Length;
MSBuild (1)
ReadOnlyEmptyDictionary.cs (1)
57public int Count
PresentationCore (1)
System\Windows\BinaryFormat\ListConverterHelper.cs (1)
23public int Count => _values.Count;
PresentationFramework (2)
MS\Internal\WindowsRuntime\Generated\WinRT\Projections\IReadOnlyList.cs (2)
67public int Count 427public int Count => _FromVectorView.Count;
Shared (2)
EmptyCollections\EmptyReadonlyDictionary.cs (1)
21public int Count => 0;
EmptyCollections\EmptyReadOnlyList.cs (1)
24public int Count => 0;
Shared.Tests (1)
JsonSchemaExporter\TestTypes.cs (1)
1108public int Count => 1;
SignalRSamples (1)
ConnectionList.cs (1)
26public int Count => _connections.Count;
SocialWeather (1)
ConnectionList.cs (1)
27public int Count => _connections.Count;
System.Collections (11)
System\Collections\Generic\LinkedList.cs (1)
49public int Count
System\Collections\Generic\OrderedDictionary.cs (3)
243public int Count => _count; 1473public int Count => _dictionary.Count; 1668public int Count => _dictionary.Count;
System\Collections\Generic\PriorityQueue.cs (1)
950public int Count => _queue._size;
System\Collections\Generic\SortedDictionary.cs (3)
137public int Count 589public int Count 750public int Count
System\Collections\Generic\SortedList.cs (1)
282public int Count
System\Collections\Generic\SortedSet.cs (1)
266public int Count
System\Collections\Generic\Stack.cs (1)
57public int Count => _size;
System.Collections.Concurrent (3)
System\Collections\Concurrent\BlockingCollection.cs (1)
103public int Count
System\Collections\Concurrent\ConcurrentBag.cs (1)
486public int Count
System\Collections\Concurrent\ConcurrentStack.cs (1)
134public int Count
System.Collections.Immutable (16)
System\Collections\Frozen\FrozenDictionary.cs (1)
321public int Count => CountCore;
System\Collections\Frozen\FrozenSet.cs (1)
264public int Count => CountCore;
System\Collections\Immutable\ImmutableArray_1.Builder.cs (1)
90public int Count
System\Collections\Immutable\ImmutableArray_1.cs (1)
67int IReadOnlyCollection<T>.Count
System\Collections\Immutable\ImmutableDictionary_2.Builder.cs (1)
140public int Count
System\Collections\Immutable\ImmutableDictionary_2.cs (1)
131public int Count
System\Collections\Immutable\ImmutableExtensions.cs (2)
128public int Count 195public int Count
System\Collections\Immutable\ImmutableHashSet_1.Builder.cs (1)
83public int Count
System\Collections\Immutable\ImmutableHashSet_1.cs (1)
92public int Count
System\Collections\Immutable\ImmutableList_1.Builder.cs (1)
70public int Count
System\Collections\Immutable\ImmutableList_1.cs (1)
142public int Count => _root.Count;
System\Collections\Immutable\ImmutableSortedDictionary_2.Builder.cs (1)
118public int Count
System\Collections\Immutable\ImmutableSortedDictionary_2.cs (1)
108public int Count
System\Collections\Immutable\ImmutableSortedSet_1.Builder.cs (1)
76public int Count
System\Collections\Immutable\ImmutableSortedSet_1.cs (1)
115public int Count
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\Metrics\TagList.netcore.cs (1)
52public readonly int Count => _tagsCount;
System.Formats.Nrbf (1)
System\Formats\Nrbf\RecordMap.cs (1)
20public int Count => _map.Count;
System.Linq (4)
System\Linq\Lookup.cs (1)
307public int Count => 0;
System\Linq\Range.SpeedOpt.cs (1)
38public int Count => _end - _start;
System\Linq\Repeat.SpeedOpt.cs (1)
34public int Count => _count;
System\Linq\SkipTake.SpeedOpt.cs (1)
104public int Count
System.Linq.Expressions (1)
System\Linq\Expressions\Compiler\CompilerScope.cs (1)
551public int Count => _provider.ParameterCount;
System.Net.Http (3)
System\Net\Http\Headers\HeaderStringValues.cs (1)
36public int Count => _value switch
System\Net\Http\Headers\HttpHeadersNonValidated.cs (1)
28public int Count => _headers?.Count ?? 0;
System\Net\Http\HttpRequestOptions.cs (1)
50int IReadOnlyCollection<KeyValuePair<string, object?>>.Count => Options.Count;
System.Net.Primitives (1)
System\Net\CookieCollection.cs (1)
121public int Count
System.Net.WebSockets.Client (1)
System\Net\WebSockets\HttpResponseHeadersReadOnlyCollection.cs (1)
41public int Count => _headers.Count;
System.Private.CoreLib (14)
src\libraries\System.Private.CoreLib\src\System\ArraySegment.cs (1)
71public int Count => _count;
src\libraries\System.Private.CoreLib\src\System\Collections\Concurrent\ConcurrentQueue.cs (1)
256public int Count
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Dictionary.cs (3)
209public int Count => _count - _freeCount; 1926public int Count => _dictionary.Count; 2121public int Count => _dictionary.Count;
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\HashSet.cs (1)
357public int Count => _count - _freeCount;
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\List.cs (1)
127public int Count => _size;
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Queue.cs (1)
55public int Count => _size;
src\libraries\System.Private.CoreLib\src\System\Collections\ObjectModel\Collection.cs (1)
32public int Count => items.Count;
src\libraries\System.Private.CoreLib\src\System\Collections\ObjectModel\ReadOnlyCollection.cs (1)
33public int Count => list.Count;
src\libraries\System.Private.CoreLib\src\System\Collections\ObjectModel\ReadOnlyDictionary.cs (3)
71public int Count => m_dictionary.Count; 278public int Count => _collection.Count; 331public int Count => _collection.Count;
src\libraries\System.Private.CoreLib\src\System\Collections\ObjectModel\ReadOnlySet.cs (1)
34public int Count => _set.Count;
System.Private.Windows.Core (2)
System\Collections\Generic\ListConverter.cs (1)
28public int Count => _values.Count;
System\Private\Windows\BinaryFormat\Serializer\ArraySingleString.StringListAdapter.cs (1)
30int IReadOnlyCollection<string?>.Count => _recordList.Count;
System.Private.Windows.Core.TestUtilities (2)
XUnit\EnumerableTupleTheoryData.cs (2)
17public int Count => _data.Count(); 35public int Count => _data.Count();
System.Reflection.Metadata (25)
System\Reflection\Metadata\PortablePdb\HandleCollections.Debug.cs (7)
27public int Count 126public int Count 232public int Count 440public int Count 546public int Count 645public int Count 752public int Count
System\Reflection\Metadata\TypeSystem\HandleCollections.TypeSystem.cs (18)
26public int Count 134public int Count 251public int Count 372public int Count 479public int Count 599public int Count 719public int Count 839public int Count 955public int Count 1054public int Count 1166public int Count 1261public int Count 1351public int Count 1441public int Count 1531public int Count 1664public int Count 1775public int Count 1865public int Count
System.Security.Cryptography.Cose (1)
System\Security\Cryptography\Cose\CoseHeaderMap.cs (1)
55public int Count => _headerParameters.Count;
System.Text.Json.SourceGeneration (1)
src\libraries\Common\src\SourceGenerators\ImmutableEquatableArray.cs (1)
22public int Count => _values.Length;
System.Text.RegularExpressions (4)
System\Text\RegularExpressions\CaptureCollection.cs (1)
31public int Count => _capcount;
System\Text\RegularExpressions\GroupCollection.cs (2)
36public int CountCount => _match._matchcount.Length;
System\Text\RegularExpressions\MatchCollection.cs (1)
45public int Count
System.Windows.Forms.Primitives (1)
System\Windows\Forms\NonNullCollection.cs (1)
32public int Count => _list.Count;
2111 references to Count
AnalyzerRunner (2)
DiagnosticAnalyzerRunner.cs (1)
154Console.WriteLine($"{project.Name} ({project.DocumentIds.Count} documents): {averageEditsInProject:0.00} edits per second");
Program.cs (1)
179Console.WriteLine("Number of documents:\t\t" + projects.Sum(x => x.DocumentIds.Count));
Aspire.Dashboard (8)
Authentication\AspirePolicyEvaluator.cs (1)
40if (policy.AuthenticationSchemes != null && policy.AuthenticationSchemes.Count > 0)
DashboardWebApplication.cs (5)
428logger.LogError("Failed to start the dashboard due to {Count} configuration error(s).", validationFailures.Count); 475var hasSingleEndpoint = frontendAddresses.Count == 1 && IsSameOrNull(frontendAddresses[0], otlpGrpcAddress) && IsSameOrNull(frontendAddresses[0], otlpHttpAddress); 478var browserEndpointNames = new List<string>(capacity: frontendAddresses.Count); 493if (frontendAddresses.Count == 1) 500for (var i = 0; i < frontendAddresses.Count; i++)
ResourceService\DashboardClient.cs (2)
455if (batch.Count == 1) 514if (batch.Count == 1)
Aspire.Dashboard.Components.Tests (3)
Pages\ResourcesTests.cs (1)
177return filterComponents.Count == 3;
Pages\TraceDetailsTests.cs (2)
129await AsyncTestHelpers.AssertIsTrueRetryAsync(() => rows.Count == 3, "Expected rows to be rendered."); 137await AsyncTestHelpers.AssertIsTrueRetryAsync(() => rows.Count == 2, "Expected rows to be rendered.");
Aspire.Hosting (6)
ApplicationModel\ExpressionResolver.cs (2)
84var args = new object?[expr.ValueProviders.Count]; 86for (var i = 0; i < expr.ValueProviders.Count; i++)
ApplicationModel\ReferenceExpression.cs (2)
63var args = new object?[ValueProviders.Count]; 64for (var i = 0; i < ValueProviders.Count; i++)
ApplicationModel\ResourceLoggerService.cs (2)
414var logs = new LogLine[entries.Count]; 415for (var i = 0; i < entries.Count; i++)
Aspire.Hosting.Azure.AppContainers (2)
AzureContainerAppsInfrastructure.cs (2)
684if (expr.Format == "{0}" && expr.ValueProviders.Count == 1) 689var args = new object[expr.ValueProviders.Count];
Aspire.Hosting.Tests (5)
Dcp\DcpExecutorTests.cs (1)
583Assert.Equal(7, watchLogsResults1.Count);
ResourceLoggerServiceTests.cs (4)
48Assert.Equal(2, allLogs.Count); 129Assert.Equal(2, allLogs.Count); 187Assert.Equal(2, allLogs.Count); 206Assert.Equal(4, allLogs.Count);
Aspire.RabbitMQ.Client.Tests (2)
AspireRabbitMQLoggingTests.cs (2)
138Assert.Equal(3, errorEvent.Count); 184Assert.Equal(4, errorEvent.Count);
Aspire.RabbitMQ.Client.v7.Tests (2)
tests\Aspire.RabbitMQ.Client.Tests\AspireRabbitMQLoggingTests.cs (2)
138Assert.Equal(3, errorEvent.Count); 184Assert.Equal(4, errorEvent.Count);
Aspire.Workload.Tests (1)
WorkloadTestsBase.cs (1)
168if (allRows.Count == 0)
Diagnostics.EFCore.FunctionalTests (1)
MigrationsEndPointMiddlewareTest.cs (1)
134Assert.Equal(2, appliedMigrations.Count);
dotnet-dev-certs (2)
Program.cs (2)
330reporter.Output(certificates.Count switch 333_ => $"{certificates.Count} {certificateState} certificates were found: {CertificateManager.ToCertificateDescription(certificates)}"
dotnet-svcutil-lib (1)
Shared\MSBuildProj.cs (1)
901foreach (var rtLib in depContext.RuntimeLibraries.Where(l => l.NativeLibraryGroups.Count == 0))
HttpStress (1)
Program.cs (1)
47if (cmdline.Errors.Count > 0)
illink (3)
ILLink.CodeFixProvider (1)
DynamicallyAccessedMembersCodeFixProvider.cs (1)
101 if (diagnostic.AdditionalLocations.Count == 0)
ILLink.RoslynAnalyzer (2)
src\tools\illink\src\ILLink.Shared\TrimAnalysis\HandleCallAction.cs (2)
91 Debug.Assert (argumentValues.Count == 1); 1126 if (argumentValues.Count > argsParam) {
KeyManagementSample (2)
Program.cs (2)
38Console.WriteLine($"The key ring contains {allKeys.Count} key(s)."); 56Console.WriteLine($"The key ring contains {allKeys.Count} key(s).");
Microsoft.Analyzers.Extra (1)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
407if (index < details.MessageArgs.Count)
Microsoft.Analyzers.Extra.Tests (24)
AsyncCallInsideUsingBlockAnalyzerTests.cs (2)
405for (int i = 0; i < d.Count; i++) 410d.Count.Should().Be(expected);
AsyncMethodWithoutCancellationTests.cs (2)
166for (int i = 0; i < d.Count; i++) 171d.Count.Should().Be(expected);
CallAnalysis\ArraysTests.cs (2)
127Assert.Equal(54, d.Count); 128for (int i = 0; i < d.Count; i++)
CallAnalysis\LegacyCollectionTests.cs (2)
49Assert.Equal(8, d.Count); 50for (int i = 0; i < d.Count; i++)
CallAnalysis\SplitTests.cs (1)
35for (int i = 0; i < d.Count; i++)
CallAnalysis\StartsEndsWithTests.cs (4)
61Assert.Equal(8, d.Count); 63for (int i = 0; i < d.Count; i++) 119Assert.Equal(8, d.Count); 121for (int i = 0; i < d.Count; i++)
CallAnalysis\StaticTimeTests.cs (2)
82Assert.Equal(17, d.Count); 83for (int i = 0; i < d.Count; i++)
CallAnalysis\ValueTupleTests.cs (2)
51Assert.Equal(16, d.Count); 52for (int i = 0; i < d.Count; i++)
CoalesceAnalyzerTests.cs (4)
97Assert.Equal(4, d.Count); 98for (int i = 0; i < d.Count; i++) 165Assert.Equal(5, d.Count); 166for (int i = 0; i < d.Count; i++)
ConditionalAccessAnalyzerTests.cs (2)
110Assert.Equal(8, d.Count); 111for (int i = 0; i < d.Count; i++)
MakeExeTypesInternalTests.cs (1)
162for (int i = 0; i < d.Count; i++)
Microsoft.Analyzers.Local.Tests (11)
ApiLifecycle\ApiLifecycleAnalyzerTest.cs (4)
44Assert.Equal(expectedDiagnostics, diagnostics.Count); 46for (int i = 0; i < diagnostics.Count; i++) 70Assert.Equal(expectedDiagnostics, diagnostics.Count); 72for (int i = 0; i < diagnostics.Count; i++)
CallAnalysis\ToInvariantStringTests.cs (2)
42Assert.Equal(4, d.Count); 43for (int i = 0; i < d.Count; i++)
InternalReferencedInPublicDocAnalyzerTests.cs (4)
43var casesCnt = Math.Max(firstList.Count, secondList.Count); 46var first = $"{firstPrefix} {firstList[i % firstList.Count]}"; 47var second = $"{secondPrefix} {secondList[i % secondList.Count]}";
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.AspNetCore.App.Analyzers.Test (3)
RouteEmbeddedLanguage\RoutePatternParserTests.cs (3)
213Assert.True(routeParameter.Policies.Length == parsedRoutePattern.ParameterPolicies.Count, "ParameterPolicies"); 214for (var i = 0; i < parsedRoutePattern.ParameterPolicies.Count; i++) 234parsedRoutePatterns.Count == tree.RouteParameters.Length,
Microsoft.AspNetCore.AsyncState (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.AspNetCore.Authentication.JwtBearer (1)
JwtBearerHandler.cs (1)
381var messages = new List<string>(exceptions.Count);
Microsoft.AspNetCore.Authorization.Policy (4)
AuthorizationMiddleware.cs (1)
123if (requirementData.Count > 0)
AuthorizationMiddlewareResultHandler.cs (2)
28if (policy.AuthenticationSchemes.Count > 0) 42if (policy.AuthenticationSchemes.Count > 0)
PolicyEvaluator.cs (1)
36if (policy.AuthenticationSchemes != null && policy.AuthenticationSchemes.Count > 0)
Microsoft.AspNetCore.Components (46)
ParameterView.cs (1)
435if (nextIndex < _cascadingParameters.Count)
Rendering\ComponentState.cs (4)
47if (_cascadingParameters.Count != 0) 198remainingCascadingParameters ??= new(_cascadingParameters.Count /* upper bound on capacity needed */); 249var numCascadingParameters = _cascadingParameters!.Count; 266var numCascadingParameters = _cascadingParameters!.Count;
ResourceAssetCollection.cs (1)
68int IReadOnlyCollection<ResourceAsset>.Count => _resources.Count;
Routing\RouteTable.cs (2)
101else if (parameter.ParameterPolicies.Count > 0 && !parameter.IsCatchAll) 105for (var i = 0; i < parameter.ParameterPolicies.Count; i++)
Routing\RouteTableFactory.cs (6)
319for (var k = 0; k < x.RoutePattern.PathSegments.Count; k++) 323if (leftSegment.Parts.Count != rightSegment.Parts.Count) 328for (var l = 0; l < leftSegment.Parts.Count; l++) 349for (var i = 0; i < obj.RoutePattern.PathSegments.Count; i++) 352for (var j = 0; j < segment.Parts.Count; j++)
src\Http\Routing\src\Patterns\RoutePattern.cs (1)
144var parametersCount = parameters.Count;
src\Http\Routing\src\Patterns\RoutePatternFactory.cs (6)
476for (var j = 0; j < segment.Parts.Count; j++) 546for (var i = 0; i < segment.Parts.Count; i++) 610parameter.ParameterPolicies.Count > 0) 617parameterConstraints = new List<RoutePatternParameterPolicyReference>(parameter.ParameterPolicies.Count); 621if (parameter.ParameterPolicies.Count > 0) 627&& parameter.ParameterPolicies.Count == 0
src\Http\Routing\src\Patterns\RoutePatternMatcher.cs (9)
33_hasDefaultValue = new bool[RoutePattern.PathSegments.Count]; 34_defaultValues = new object[RoutePattern.PathSegments.Count]; 36for (var i = 0; i < RoutePattern.PathSegments.Count; i++) 86var pathSegment = i >= RoutePattern.PathSegments.Count ? null : RoutePattern.PathSegments[i]; 106for (; i < RoutePattern.PathSegments.Count; i++) 163for (; i < RoutePattern.PathSegments.Count; i++) 291var indexOfLastSegment = routeSegment.Parts.Count - 1; 339Debug.Assert(routeSegment.Parts.Count > 1); 402if (indexOfLastSegmentUsed == (routeSegment.Parts.Count - 1))
src\Http\Routing\src\Patterns\RoutePatternParser.cs (2)
322for (var j = 0; j < segment.Parts.Count; j++) 327(i != segments.Count - 1 || j != segment.Parts.Count - 1))
src\Http\Routing\src\Patterns\RoutePatternPathSegment.cs (1)
35public bool IsSimple => Parts.Count == 1;
src\Http\Routing\src\Template\RoutePrecedence.cs (8)
60ValidateSegementLength(routePattern.PathSegments.Count); 64for (var i = 0; i < routePattern.PathSegments.Count; i++) 114ValidateSegementLength(routePattern.PathSegments.Count); 120for (var i = 0; i < routePattern.PathSegments.Count; i++) 179if (pathSegment.Parts.Count > 1) 194if (parameterPart.ParameterPolicies.Count > 0) 251if (pathSegment.Parts.Count > 1) 276if (parameterPart.ParameterPolicies.Count > 0)
src\Http\Routing\src\Tree\UrlMatchingTree.cs (5)
82for (var i = 0; i < entry.RoutePattern.PathSegments.Count; i++) 98Debug.Assert(segment.Parts.Count == 1); 185if (parameterPart.ParameterPolicies.Count > 0 && !parameterPart.IsCatchAll) 207if (parameterPart.ParameterPolicies.Count > 0 && parameterPart.IsCatchAll) 252for (var i = currentParameterIndex; i < segments.Count; i++)
Microsoft.AspNetCore.Components.Endpoints (19)
Assets\ImportMapDefinition.cs (1)
89for (var i = 0; i < asset.Properties!.Count; i++)
Discovery\AssemblyComponentLibraryDescriptor.cs (2)
50return $"Assembly = {AssemblyName}, Pages = {Pages.Count}, Components = {Components.Count}";
Discovery\ComponentCollectionBuilder.cs (2)
51totalCount += value.Count; 63for (var i = 0; i < components.Count; i++, current++)
Discovery\PageCollectionBuilder.cs (2)
50totalCount += value.Count; 63for (var i = 0; i < pages.Count; i++)
Discovery\RazorComponentApplication.cs (3)
40for (var i = 0; i < Components.Count; i++) 65return $"Pages = {Pages.Count}, Components = {Components.Count}";
FormMapping\Converters\FileConverter.cs (2)
42for (var i = 0; i < targetFiles.Count; i++) 67if (formFileCollection.Count == 0)
FormMapping\FormDataReader.cs (3)
178return _readOnlyMemoryKeys.Count > 0; 183_prefixResolver = new PrefixResolver(_readOnlyMemoryKeys.Keys, _readOnlyMemoryKeys.Count); 324$"Key count = {_readOnlyMemoryKeys.Count}, Prefix = {_currentPrefixBuffer}, Error count = {_errorCount}, Current depth = {_currentDepth}";
FormMapping\HttpContextFormValueMapper.cs (1)
117if (form.Count == 0)
src\Shared\Components\PrerenderComponentApplicationStore.cs (1)
64if (state is not null && state.Count > 0)
src\Shared\Components\ResourceCollectionResolver.cs (2)
51if (descriptor.Selectors.Count == 0) 54for (var i = 0; i < descriptor.Properties.Count; i++)
Microsoft.AspNetCore.Components.Endpoints.Tests (2)
RazorComponentEndpointDataSourceTest.cs (1)
30Assert.Equal(3, endpoints.Count);
RazorComponentResultTest.cs (1)
46Assert.Equal(2, result.Parameters.Count);
Microsoft.AspNetCore.Components.Server (12)
Circuits\CircuitFactory.cs (2)
66if (components.Count > 0) 93var circuitHandlers = components.Count == 0 ? [] : scope.ServiceProvider.GetServices<CircuitHandler>()
Circuits\CircuitHost.cs (7)
122if (Descriptors.Count > 0) 130var count = Descriptors.Count; 147if (Descriptors.Count > 0) 157_isFirstUpdate = Descriptors.Count == 0; 633if (circuitHandlers.Count == 0) 641for (var i = circuitHandlers.Count - 1; i >= 0; i--) 744if (Descriptors.Count > 0)
src\Shared\Components\PrerenderComponentApplicationStore.cs (1)
64if (state is not null && state.Count > 0)
src\SignalR\common\Protocols.MessagePack\src\Protocol\MessagePackHubProtocolWorker.cs (2)
300if (parameterTypes.Count != argumentCount) 303$"Invocation provides {argumentCount} argument(s) but target expects {parameterTypes.Count}.");
Microsoft.AspNetCore.Components.Web (5)
Forms\InputBase.cs (1)
319if (AdditionalAttributes!.Count == 1)
Forms\InputFile\InputFileChangeEventArgs.cs (4)
25public int FileCount => _files.Count; 31public IBrowserFile File => _files.Count switch 46if (_files.Count > maximumFileCount) 48throw new InvalidOperationException($"The maximum number of files accepted is {maximumFileCount}, but {_files.Count} were supplied.");
Microsoft.AspNetCore.Components.WebAssembly (2)
HotReload\HotReloadAgent.cs (1)
190for (var i = 0; i < deltas.Count; i++)
src\Shared\Components\PrerenderComponentApplicationStore.cs (1)
64if (state is not null && state.Count > 0)
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
Builder\WebAssemblyRazorComponentsEndpointConventionBuilderExtensions.cs (1)
60if (descriptors != null && descriptors.Count > 0)
ComponentWebAssemblyConventions.cs (1)
41for (var i = 0; i < descriptors.Count; i++)
Microsoft.AspNetCore.DataProtection (1)
KeyManagement\XmlKeyManager.cs (1)
180var elementCount = allElements.Count;
Microsoft.AspNetCore.DataProtection.Tests (6)
KeyManagement\XmlKeyManagerTests.cs (2)
959Assert.Equal(9, repository.GetAllElements().Count); // 4 keys, 2 time-revocations, 3 guid-revocations 972Assert.Equal(4, repository.GetAllElements().Count); // 2 keys, 1 time-revocation, 1 guid-revocations
Repositories\EphemeralXmlRepositoryTests.cs (1)
58Assert.Equal(2, deletableElements.Count);
Repositories\FileSystemXmlRepositoryTests.cs (2)
163Assert.Equal(2, deletableElements.Count); 224Assert.Equal(3, deletableElements.Count);
Repositories\RegistryXmlRepositoryTests.cs (1)
151Assert.Equal(2, deletableElements.Count);
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (40)
Logging\AcceptanceTests.cs (26)
200Assert.Equal(8, state!.Count); 205Assert.Equal(7, state!.Count); 260Assert.Equal(9, state!.Count); 265Assert.Equal(7, state!.Count); 304Assert.Equal(5, logRecords.Count); 316Assert.Equal(6, requestState!.Count); 326Assert.Equal(3, requestBodyState!.Count); 329Assert.Equal(2, responseState!.Count); 333Assert.Equal(2, responseBodyState!.Count); 336Assert.Equal(2, durationState!.Count); 374Assert.Equal(9, state!.Count); 420Assert.Equal(9, state!.Count); 462Assert.Equal(7, state!.Count); 485Assert.Equal(3, logRecords.Count); 494Assert.Equal(5, firstState!.Count); 498Assert.Equal(3, secondState!.Count); 523Assert.Equal(6, logRecords.Count); 536Assert.Equal(5, firstRecord!.Count); 538Assert.Equal(5, fourthRecord!.Count); 552Assert.Equal(2, thirdRecord!.Count); 553Assert.Equal(2, sixthRecord!.Count); 579Assert.Equal(7, state!.Count); 620Assert.Equal(10, state!.Count); 654Assert.Equal(7, state!.Count); 712Assert.Equal(7, logCollector.GetSnapshot()[0].StructuredState!.Count); 752Assert.Equal(7, logCollector.GetSnapshot()[1].StructuredState!.Count);
Logging\IncomingHttpDimensionsTests.cs (2)
17Assert.Equal(9, dimensions.Count); 20Assert.Equal(names.Count, dimensions.Count);
Logging\IncomingHttpRouteUtilityTests.cs (6)
96Assert.Equal(2, sensitiveParameters.Count); 136Assert.Equal(2, sensitiveParameters.Count); 314Assert.Equal(3, sensitiveParameters.Count); 361Assert.Equal(2, sensitiveParameters.Count); 403Assert.Equal(2, sensitiveParameters.Count); 412Assert.Equal(2, sensitiveParameters.Count);
Logging\RequestHeadersEnricherTests.cs (2)
104Assert.True(enrichedState.Count == 2); 286Assert.True(enrichedState.Count == 0);
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
Microsoft.AspNetCore.HeaderParsing (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.AspNetCore.HeaderParsing.Tests (2)
ParserTests.cs (2)
90Assert.Equal(2, result.Count); 254Assert.Equal(2, result.Count);
Microsoft.AspNetCore.Http (1)
Features\FormFeature.cs (1)
396var metadataCount = formOptionsMetadatas.Count;
Microsoft.AspNetCore.Http.Connections.Tests (8)
MapConnectionHandlerTests.cs (8)
53Assert.Equal(2, policies.Count); 63Assert.Equal(2, policies.Count); 143Assert.Equal(2, endpoint.Metadata.GetOrderedMetadata<IAuthorizeData>().Count); 148Assert.Equal(2, endpoint.Metadata.GetOrderedMetadata<IAuthorizeData>().Count); 174Assert.Equal(2, endpoint.Metadata.GetOrderedMetadata<IAuthorizeData>().Count); 179Assert.Equal(2, endpoint.Metadata.GetOrderedMetadata<IAuthorizeData>().Count); 233Assert.Equal(2, endpoint.Metadata.GetOrderedMetadata<IAuthorizeData>().Count); 238Assert.Equal(2, endpoint.Metadata.GetOrderedMetadata<IAuthorizeData>().Count);
Microsoft.AspNetCore.Http.Extensions (4)
src\Components\Endpoints\src\FormMapping\Converters\FileConverter.cs (1)
67if (formFileCollection.Count == 0)
src\Components\Endpoints\src\FormMapping\FormDataReader.cs (3)
178return _readOnlyMemoryKeys.Count > 0; 183_prefixResolver = new PrefixResolver(_readOnlyMemoryKeys.Keys, _readOnlyMemoryKeys.Count); 324$"Key count = {_readOnlyMemoryKeys.Count}, Prefix = {_currentPrefixBuffer}, Error count = {_errorCount}, Current depth = {_currentDepth}";
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
RequestDelegateGeneratorSuppressor.cs (1)
45var location = diagnostic.AdditionalLocations.Count > 0
Microsoft.AspNetCore.Http.Results (5)
ChallengeHttpResult.cs (1)
80if (AuthenticationSchemes != null && AuthenticationSchemes.Count > 0)
ForbidHttpResult.cs (2)
91if (AuthenticationSchemes != null && AuthenticationSchemes.Count > 0) 93for (var i = 0; i < AuthenticationSchemes.Count; i++)
SignOutHttpResult.cs (2)
80if (AuthenticationSchemes.Count == 0) 86for (var i = 0; i < AuthenticationSchemes.Count; i++)
Microsoft.AspNetCore.JsonPatch (1)
Internal\ObjectVisitor.cs (1)
55for (var i = 0; i < _path.Segments.Count - 1; i++)
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
ApiResponseTypeProvider.cs (1)
402for (var i = 0; i < providers.Count; i++)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (1)
DefaultApiDescriptionProviderTest.cs (1)
151Assert.Equal(3, descriptions.Count);
Microsoft.AspNetCore.Mvc.Core (60)
ActionConstraints\HttpMethodActionConstraint.cs (2)
63if (_httpMethods.Count == 0) 71for (var i = 0; i < _httpMethods.Count; i++)
ConsumesAttribute.cs (1)
210if (candidate.Constraints == null || candidate.Constraints.Count == 0 ||
Infrastructure\ActionSelector.cs (10)
70if (matches.Count > 0) 86if (finalMatches == null || finalMatches.Count == 0) 90else if (finalMatches.Count == 1) 115var actionsCount = actions.Count; 131var matchesCount = matches.Count; 154for (var i = 0; i < candidates.Count; i++) 159for (var j = 0; j < candidate.Constraints.Count; j++) 189for (var i = 0; i < candidates.Count; i++) 198for (var j = 0; j < candidate.Constraints.Count; j++) 233if (matches?.Count > 0)
Infrastructure\CopyOnWriteList.cs (1)
43public int Count => Readable.Count;
ModelBinding\Binders\ComplexObjectModelBinder.cs (9)
83var values = new object[boundConstructor.BoundConstructorParameters!.Count]; 231if (parameters.Count == 0) 237for (var i = 0; i < parameters.Count; i++) 292for (var i = 0; i < parameters.Count; i++) 327if (boundProperties.Count == 0) 333for (var i = 0; i < boundProperties.Count; i++) 384for (var i = 0; i < boundProperties.Count; i++) 548(!performsConstructorBinding || modelMetadata.BoundConstructor!.BoundConstructorParameters!.Count == 0)) 614for (var i = 0; i < parameters.Count; i++)
ModelBinding\Binders\ComplexObjectModelBinderProvider.cs (2)
49var parameterBinders = boundConstructor.BoundConstructorParameters!.Count == 0 ? 51new IModelBinder[boundConstructor.BoundConstructorParameters.Count];
ModelBinding\FormFileValueProvider.cs (1)
44var count = formFiles.Count;
ModelBinding\FormFileValueProviderFactory.cs (1)
52if (form.Files.Count > 0)
ModelBinding\Validation\ClientValidatorCache.cs (2)
41var items = new List<ClientValidatorItem>(metadata.ValidatorMetadata.Count); 42for (var i = 0; i < metadata.ValidatorMetadata.Count; i++)
ModelBinding\Validation\CompositeClientModelValidatorProvider.cs (1)
37for (var i = 0; i < ValidatorProviders.Count; i++)
ModelBinding\Validation\DefaultComplexObjectValidationStrategy.cs (4)
66_count = _properties.Count + _parameters.Count; 84if (_index < _parameters.Count) 107var property = _properties[_index - _parameters.Count];
ModelBinding\Validation\ValidationVisitor.cs (1)
213var count = validators.Count;
ModelBinding\Validation\ValidatorCache.cs (2)
31var items = new List<ValidatorItem>(metadata.ValidatorMetadata.Count); 32for (var i = 0; i < metadata.ValidatorMetadata.Count; i++)
Routing\ActionConstraintMatcherPolicy.cs (8)
38for (var i = 0; i < endpoints.Count; i++) 90for (var i = 0; i < finalMatches.Count; i++) 121if (matches?.Count > 0) 165for (var i = 0; i < items.Count; i++) 171for (var j = 0; j < constraints.Count; j++) 200for (var i = 0; i < items.Count; i++) 210for (var j = 0; j < constraints.Count; j++) 258if (matches?.Count > 0)
Routing\ActionEndpointFactory.cs (6)
243for (var i = 0; i < groupConventions.Count; i++) 248for (var i = 0; i < conventions.Count; i++) 253for (var i = 0; i < route.Conventions.Count; i++) 347for (var i = 0; i < groupConventions.Count; i++) 446for (var i = 0; i < conventions.Count; i++) 451for (var i = 0; i < perRouteConventions.Count; i++)
Routing\ControllerActionEndpointDataSource.cs (1)
87for (var i = 0; i < actions.Count; i++)
Routing\DynamicControllerEndpointMatcherPolicy.cs (4)
40for (var i = 0; i < endpoints.Count; i++) 117if (endpoints.Count == 0 && dynamicControllerMetadata != null) 125else if (endpoints.Count == 0) 147if (endpoints.Count == 0)
Routing\EndpointRoutingUrlHelper.cs (1)
89private string DebuggerToString() => $"Endpoints = {_endpointDataSource.Endpoints.Count}";
Routing\KnownRouteValueConstraint.cs (1)
99for (var i = 0; i < actionDescriptors.Items.Count; i++)
Routing\MvcRouteHandler.cs (1)
44if (candidates == null || candidates.Count == 0)
Routing\RoutePatternWriter.cs (1)
26for (var i = 0; i < segment.Parts.Count; i++)
Microsoft.AspNetCore.Mvc.Core.Test (6)
ApplicationModels\DefaultApplicationModelProviderTest.cs (2)
444Assert.Equal(2, model.Attributes.Count); 466Assert.Equal(2, model.Attributes.Count);
Formatters\OutputFormatterTests.cs (1)
122Assert.Equal(2, contentTypes.Count);
ModelBinding\Metadata\DefaultBindingMetadataProviderTest.cs (1)
405Assert.Equal(2, context.ParameterAttributes.Count);
ModelBinding\Metadata\ModelAttributesTest.cs (2)
165Assert.Equal(3, attributes.Attributes.Count); 170Assert.Equal(2, attributes.PropertyAttributes.Count);
Microsoft.AspNetCore.Mvc.DataAnnotations (1)
DataAnnotationsMetadataProvider.cs (1)
304var contextAttributesCount = contextAttributes.Count;
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (2)
DataAnnotationsModelValidatorProviderTest.cs (2)
162var items = new List<ValidatorItem>(metadata.ValidatorMetadata.Count); 163for (var i = 0; i < metadata.ValidatorMetadata.Count; i++)
Microsoft.AspNetCore.Mvc.Razor (4)
RazorView.cs (1)
163for (var i = 0; i < ViewStartPages.Count; i++)
RazorViewEngine.cs (1)
464var viewStarts = new IRazorPage[result.ViewStartEntries!.Count];
ViewLocationCacheKey.cs (2)
103(ViewLocationExpanderValues.Count != y.ViewLocationExpanderValues.Count))
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (5)
ChecksumValidator.cs (1)
66for (var i = 0; i < checksums.Count; i++)
PageLoaderMatcherPolicy.cs (1)
42for (var i = 0; i < endpoints.Count; i++)
RuntimeViewCompiler.cs (3)
283var expirationTokens = new List<IChangeToken>(checksums.Count); 285for (var i = 0; i < checksums.Count; i++) 318if (cSharpDocument.Diagnostics.Count > 0)
Microsoft.AspNetCore.Mvc.RazorPages (7)
ApplicationModels\DefaultPageApplicationModelProvider.cs (1)
156for (var i = 0; i < pageModel.HandlerTypeAttributes.Count; i++)
Filters\PageViewDataAttributeFilter.cs (1)
36for (var i = 0; i < Properties.Count; i++)
Infrastructure\DynamicPageEndpointMatcherPolicy.cs (4)
43for (var i = 0; i < endpoints.Count; i++) 116if (endpoints.Count == 0 && dynamicPageMetadata != null) 124else if (endpoints.Count == 0) 146if (endpoints.Count == 0)
Infrastructure\PageActionEndpointDataSource.cs (1)
54for (var i = 0; i < actions.Count; i++)
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
ApplicationModels\AuthorizationPageApplicationModelProviderTest.cs (1)
131Assert.Equal(3, authorizeFilter.Policy.Requirements.Count);
Microsoft.AspNetCore.Mvc.TagHelpers (6)
GlobbingUrlBuilder.cs (2)
83var urls = new List<string>(1 + globbedUrls.Count) 88for (var i = 0; i < globbedUrls.Count; i++)
LinkTagHelper.cs (3)
320for (var i = 0; i < urls.Count; i++) 345if (fallbackHrefs.Count == 0) 437var fallbackHrefsCount = fallbackHrefs.Count;
ScriptTagHelper.cs (1)
355if (fallbackSrcs.Count > 0)
Microsoft.AspNetCore.Mvc.Testing (1)
WebApplicationFactory.cs (1)
329if (context == null || context.CompileLibraries.Count == 0)
Microsoft.AspNetCore.Mvc.ViewFeatures (13)
DefaultValidationHtmlAttributeProvider.cs (2)
62if (validators.Count > 0) 70for (var i = 0; i < validators.Count; i++)
Filters\ControllerViewDataAttributeFilter.cs (1)
31for (var i = 0; i < Properties.Count; i++)
Filters\SaveTempDataPropertyFilterBase.cs (2)
46for (var i = 0; i < Properties.Count; i++) 72for (var i = 0; i < Properties.Count; i++)
src\Shared\Components\ResourceCollectionResolver.cs (2)
51if (descriptor.Selectors.Count == 0) 54for (var i = 0; i < descriptor.Properties.Count; i++)
ViewComponents\DefaultViewComponentHelper.cs (2)
96for (var i = 0; i < descriptors.Items.Count; i++) 117if (descriptor.Parameters.Count == 1 && descriptor.Parameters[0].ParameterType.IsAssignableFrom(arguments.GetType()))
ViewEngines\CompositeViewEngine.cs (4)
33if (ViewEngines.Count == 0) 44for (var i = 0; i < ViewEngines.Count; i++) 82if (ViewEngines.Count == 0) 93for (var i = 0; i < ViewEngines.Count; i++)
Microsoft.AspNetCore.OpenApi (2)
Extensions\ApiDescriptionExtensions.cs (1)
52for (var i = 0; i < routePattern.PathSegments.Count; i++)
Services\OpenApiGenerator.cs (1)
331if (metadataList.Count > 0)
Microsoft.AspNetCore.Routing (124)
DecisionTree\DecisionTreeBuilder.cs (1)
75var itemCount = items.Count;
DefaultLinkGenerator.cs (1)
442if (values == null || values.Count == 0)
DefaultLinkParser.cs (1)
96for (var i = 0; i < kvp.Value.Count; i++)
EndpointDataSource.cs (4)
39var wrappedEndpoints = new RouteEndpoint[endpoints.Count]; 41for (int i = 0; i < endpoints.Count; i++) 91if (endpoints is null || endpoints.Count == 0) 113if (routeValues.Count > 0)
EndpointNameAddressScheme.cs (1)
39for (var i = 0; i < endpoints.Count; i++)
HostAttribute.cs (1)
54var hostsDisplay = (Hosts.Count == 0)
Internal\DfaGraphWriter.cs (1)
45for (var i = 0; i < endpoints.Count; i++)
Matching\AcceptsMatcherPolicy.cs (14)
44return endpoints.Any(e => e.Metadata.GetMetadata<IAcceptsMetadata>()?.ContentTypes.Count > 0); 62if (metadata == null || metadata.ContentTypes?.Count == 0) 79for (var j = 0; j < metadata.ContentTypes?.Count; j++) 96for (var j = 0; j < metadata.ContentTypes?.Count; j++) 151for (var i = 0; i < endpoints.Count; i++) 155if (contentTypes == null || contentTypes.Count == 0) 160for (var j = 0; j < contentTypes.Count; j++) 173for (var i = 0; i < endpoints.Count; i++) 177if (contentTypes.Count == 0) 197for (var j = 0; j < contentTypes.Count; j++) 266var ordered = new (ReadOnlyMediaTypeHeaderValue mediaType, int destination)[edges.Count]; 267for (var i = 0; i < edges.Count; i++) 338x?.ContentTypes.Count > 0 ? x : null, 339y?.ContentTypes.Count > 0 ? y : null);
Matching\CandidateSet.cs (3)
229switch (endpoints.Count) 246var candidates = new CandidateState[original.Length - 1 + endpoints.Count]; 305Candidates[i + endpoints.Count - 1] = new CandidateState(original[i].Endpoint, original[i].Values, original[i].Score + scoreOffset);
Matching\DataSourceDependentMatcher.cs (1)
42for (var i = 0; i < endpoints.Count; i++)
Matching\DfaMatcherBuilder.cs (18)
84maxDepth = Math.Max(maxDepth, endpoint.RoutePattern.PathSegments.Count); 383for (var i = 0; i < segment.Parts.Count; i++) 396Debug.Assert(i == segment.Parts.Count - 1 && partParameter.IsOptional); 402for (var j = 0; j < parameterPolicyReferences.Count; j++) 433for (var i = 0; i < parameterPolicyReferences.Count; i++) 477for (var k = 0; k < parameterPolicyReferences.Count; k++) 513if (depth < endpoint.RoutePattern.PathSegments.Count) 518if (endpoint.RoutePattern.PathSegments.Count == 0) 523var lastSegment = endpoint.RoutePattern.PathSegments[endpoint.RoutePattern.PathSegments.Count - 1]; 707if (endpoints == null || endpoints.Count == 0) 712var candiates = new Candidate[endpoints.Count]; 718for (var i = 1; i < endpoints.Count; i++) 753for (var i = 0; i < routeEndpoint.RoutePattern.PathSegments.Count; i++) 800for (var i = 0; i < routeEndpoint.RoutePattern.PathSegments.Count; i++) 815for (var i = 0; i < parameterPolicyReferences.Count; i++) 850for (var i = depth; i < endpoint.RoutePattern.PathSegments.Count; i++) 922for (var k = 0; k < edges.Count; k++) 932if (edge.Endpoints.Count > 0)
Matching\HostMatcherPolicy.cs (9)
51if (hosts == null || hosts.Count == 0) 84if (hosts == null || hosts.Count == 0) 92for (var j = 0; j < hosts.Count; j++) 199for (var i = 0; i < endpoints.Count; i++) 220for (var i = 0; i < endpoints.Count; i++) 293var ordered = new (EdgeKey host, int destination)[edges.Count]; 294for (var i = 0; i < edges.Count; i++) 360x?.Hosts.Count > 0 ? x : null, 361y?.Hosts.Count > 0 ? y : null);
Matching\HttpMethodMatcherPolicy.cs (13)
61for (var i = 0; i < endpoints.Count; i++) 63if (endpoints[i].Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods.Count > 0) 100if (metadata == null || metadata.HttpMethods.Count == 0) 128for (var j = 0; j < metadata.HttpMethods.Count; j++) 176for (var i = 0; i < endpoints.Count; i++) 184if (httpMethods.Count == 0) 189for (var j = 0; j < httpMethods.Count; j++) 226for (var i = 0; i < endpoints.Count; i++) 231if (httpMethods.Count == 0) 246for (var j = 0; j < httpMethods.Count; j++) 317for (var i = 0; i < edges.Count; i++) 436x?.HttpMethods.Count > 0 ? x : null, 437y?.HttpMethods.Count > 0 ? y : null);
Matching\MatcherPolicy.cs (1)
51for (var i = 0; i < endpoints.Count; i++)
Matching\NegotiationMatcherPolicy.cs (5)
31for (var i = 0; i < endpoints.Count; i++) 234for (var i = 0; i < endpoints.Count; i++) 246for (var i = 0; i < endpoints.Count; i++) 333var destinations = new (string negotiationValue, double quality, int destination)[edges.Count]; 334for (var i = 0; i < edges.Count; i++)
Patterns\DefaultRoutePatternTransformer.cs (2)
201for (var i = 0; i < policies.Count; i++) 223for (var j = 0; j < segment.Parts.Count; j++)
Patterns\RoutePattern.cs (1)
144var parametersCount = parameters.Count;
Patterns\RoutePatternFactory.cs (12)
476for (var j = 0; j < segment.Parts.Count; j++) 546for (var i = 0; i < segment.Parts.Count; i++) 610parameter.ParameterPolicies.Count > 0) 617parameterConstraints = new List<RoutePatternParameterPolicyReference>(parameter.ParameterPolicies.Count); 621if (parameter.ParameterPolicies.Count > 0) 627&& parameter.ParameterPolicies.Count == 0 1041if (leftDictionary.Count is 0) 1045if (rightDictionary.Count is 0) 1050var combinedDictionary = new Dictionary<string, TValue>(leftDictionary.Count + rightDictionary.Count, StringComparer.OrdinalIgnoreCase); 1107var leftCount = leftList.Count; 1113var rightCount = rightList.Count;
Patterns\RoutePatternMatcher.cs (9)
33_hasDefaultValue = new bool[RoutePattern.PathSegments.Count]; 34_defaultValues = new object[RoutePattern.PathSegments.Count]; 36for (var i = 0; i < RoutePattern.PathSegments.Count; i++) 86var pathSegment = i >= RoutePattern.PathSegments.Count ? null : RoutePattern.PathSegments[i]; 106for (; i < RoutePattern.PathSegments.Count; i++) 163for (; i < RoutePattern.PathSegments.Count; i++) 291var indexOfLastSegment = routeSegment.Parts.Count - 1; 339Debug.Assert(routeSegment.Parts.Count > 1); 402if (indexOfLastSegmentUsed == (routeSegment.Parts.Count - 1))
Patterns\RoutePatternParser.cs (2)
322for (var j = 0; j < segment.Parts.Count; j++) 327(i != segments.Count - 1 || j != segment.Parts.Count - 1))
Patterns\RoutePatternPathSegment.cs (1)
35public bool IsSimple => Parts.Count == 1;
RouteValuesAddressScheme.cs (3)
92for (var i = 0; i < endpoints.Count; i++) 101if (metadata == null && routeEndpoint.RoutePattern.RequiredValues.Count == 0) 118if (routeEndpoint.RoutePattern.RequiredValues.Count > 0)
Template\DefaultTemplateBinderFactory.cs (1)
49for (var i = 0; i < kvp.Value.Count; i++)
Template\RoutePrecedence.cs (8)
60ValidateSegementLength(routePattern.PathSegments.Count); 64for (var i = 0; i < routePattern.PathSegments.Count; i++) 114ValidateSegementLength(routePattern.PathSegments.Count); 120for (var i = 0; i < routePattern.PathSegments.Count; i++) 179if (pathSegment.Parts.Count > 1) 194if (parameterPart.ParameterPolicies.Count > 0) 251if (pathSegment.Parts.Count > 1) 276if (parameterPart.ParameterPolicies.Count > 0)
Template\RouteTemplate.cs (1)
32Segments = new List<TemplateSegment>(other.PathSegments.Count);
Template\TemplateBinder.cs (8)
84for (var i = 0; i < pattern.Parameters.Count; i++) 116for (var i = 0; i < pattern.Parameters.Count; i++) 254var parameterCount = _pattern.Parameters.Count; 515var segmentsCount = segments.Count; 523var partsCount = parts.Count; 722var slots = new KeyValuePair<string, object?>[pattern.Parameters.Count + filters.Length]; 724for (var i = 0; i < pattern.Parameters.Count; i++) 731slots[i + pattern.Parameters.Count] = new KeyValuePair<string, object?>(filters[i].Key, null);
Template\TemplateSegment.cs (1)
32var partCount = other.Parts.Count;
Tree\LinkGenerationDecisionTree.cs (1)
39for (var i = 0; i < entries.Count; i++)
Microsoft.AspNetCore.Routing.Microbenchmarks (2)
src\Http\Routing\test\UnitTests\Matching\RouteMatcherBuilder.cs (1)
53for (var i = 0; i < withoutDefaults.Parameters.Count; i++)
src\Http\Routing\test\UnitTests\Matching\TreeRouterMatcherBuilder.cs (1)
57for (var i = 0; i < endpoint.RoutePattern.Parameters.Count; i++)
Microsoft.AspNetCore.Routing.Tests (22)
DefaultEndpointDataSourceTests.cs (2)
39Assert.Equal(2, dataSource.Endpoints.Count); 83Assert.Equal(2, dataSource.Endpoints.Count);
Matching\RouteMatcherBuilder.cs (1)
53for (var i = 0; i < withoutDefaults.Parameters.Count; i++)
Matching\TreeRouterMatcherBuilder.cs (1)
57for (var i = 0; i < endpoint.RoutePattern.Parameters.Count; i++)
Patterns\RoutePatternFactoryTest.cs (8)
424Assert.Equal(3, actual.Parameters.Count); 453Assert.Equal(3, actual.Parameters.Count); 483Assert.Equal(3, actual.Parameters.Count); 523Assert.Equal(3, actual.Parameters.Count); 642Assert.Equal(3, parameterPart.ParameterPolicies.Count); 669Assert.Equal(3, parameterPart.ParameterPolicies.Count); 690Assert.Equal(3, actual.Parts.Count); 711Assert.Equal(3, actual.Parts.Count);
Patterns\RoutePatternParserTest.cs (9)
659if (x.PathSegments.Count != y.PathSegments.Count) 664for (var i = 0; i < x.PathSegments.Count; i++) 666if (x.PathSegments[i].Parts.Count != y.PathSegments[i].Parts.Count) 671for (int j = 0; j < x.PathSegments[i].Parts.Count; j++) 680if (x.Parameters.Count != y.Parameters.Count) 685for (var i = 0; i < x.Parameters.Count; i++)
Template\TemplateSegmentTest.cs (1)
36Assert.Equal(4, routePatternPathSegment.Parts.Count);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
HttpsTests.cs (1)
212Assert.True(requestInfoFeature.RequestInfo.Count > 0);
Microsoft.AspNetCore.Server.HttpSys.Microbenchmarks (2)
RequestHeaderBenchmarks.cs (2)
92requestStructure.Headers.UnknownHeaderCount += (ushort)headerNames.Count; 95var dataDestination = unknownHeaderStructureDestination[(unknownHeadersSize * headerNames.Count)..];
Microsoft.AspNetCore.Server.HttpSys.Tests (4)
RequestHeaderTests.cs (4)
407requestStructure.Headers.UnknownHeaderCount += (ushort)headerNames.Count; 410var dataDestination = unknownHeaderStructureDestination.Slice(unknownHeadersSize * headerNames.Count); 447requestStructure.Headers.UnknownHeaderCount += (ushort)headerNames.Count; 450var dataDestination = unknownHeaderStructureDestination.Slice(unknownHeadersSize * headerNames.Count);
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
InMemoryTransportBenchmark.cs (1)
148if (_acceptedConnections < _connections.Count)
Microsoft.AspNetCore.SignalR.Client.Core (1)
Internal\SerializedHubMessage.cs (1)
35for (var i = 0; i < messages.Count; i++)
Microsoft.AspNetCore.SignalR.Client.Tests (3)
HttpConnectionTests.Negotiate.cs (3)
304Assert.Equal(5, testHttpHandler.ReceivedRequests.Count); 411Assert.Equal(5, testHttpHandler.ReceivedRequests.Count); 475Assert.Equal(5, testHttpHandler.ReceivedRequests.Count);
Microsoft.AspNetCore.SignalR.Core (2)
Internal\DefaultHubDispatcher.cs (1)
723arguments = new object?[descriptor.OriginalParameterTypes!.Count];
SerializedHubMessage.cs (1)
30for (var i = 0; i < messages.Count; i++)
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
Protocol\JsonHubProtocol.cs (1)
836var paramCount = paramTypes.Count;
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (2)
Protocol\MessagePackHubProtocolWorker.cs (2)
300if (parameterTypes.Count != argumentCount) 303$"Invocation provides {argumentCount} argument(s) but target expects {parameterTypes.Count}.");
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (3)
Protocol\NewtonsoftJsonHubProtocol.cs (3)
807if (paramIndex < paramTypes.Count) 822var paramCount = paramTypes.Count; 897var paramCount = paramTypes.Count;
Microsoft.AspNetCore.SignalR.StackExchangeRedis (7)
Internal\RedisProtocol.cs (3)
59if (excludedConnectionIds != null && excludedConnectionIds.Count > 0) 61writer.WriteArrayHeader(excludedConnectionIds.Count); 237writer.WriteMapHeader(serializedHubMessages.Count);
RedisHubLifetimeManager.cs (4)
245var publishTasks = new List<Task>(connectionIds.Count); 260var publishTasks = new List<Task>(groupNames.Count); 277if (userIds.Count > 0) 280var publishTasks = new List<Task>(userIds.Count);
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (1)
DefaultHubMessageSerializerTests.cs (1)
30Assert.Equal(testData.SerializedCount, serializedHubMessage.Count);
Microsoft.AspNetCore.SignalR.Tests (7)
HubConnectionHandlerTests.cs (1)
2311Assert.Equal(2, resource.HubMethodArguments?.Count);
MapSignalRTests.cs (6)
125Assert.Equal(2, policies.Count); 135Assert.Equal(2, policies.Count); 191Assert.Equal(2, endpoint.Metadata.GetOrderedMetadata<IAuthorizeData>().Count); 196Assert.Equal(2, endpoint.Metadata.GetOrderedMetadata<IAuthorizeData>().Count); 252Assert.Equal(2, endpoint.Metadata.GetOrderedMetadata<IAuthorizeData>().Count); 257Assert.Equal(2, endpoint.Metadata.GetOrderedMetadata<IAuthorizeData>().Count);
Microsoft.AspNetCore.StaticAssets (5)
Development\StaticAssetDevelopmentRuntimeHandler.cs (5)
251if (descriptor.ResponseHeaders.Count == 0) 258for (var i = 0; i < descriptor.ResponseHeaders.Count; i++) 280if (descriptor.Properties.Count == 0) 285for (var i = 0; i < descriptor.Properties.Count; i++) 294if (propertiesList.Count < descriptor.Properties.Count)
Microsoft.AspNetCore.Testing (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.AspNetCore.Tests (1)
WebApplicationTests.cs (1)
1875Assert.Equal(3, ds.Endpoints.Count);
Microsoft.Build (54)
BackEnd\BuildManager\BuildManager.cs (2)
2007var finishedNodes = new HashSet<ProjectGraphNode>(projectGraph.ProjectNodes.Count); 2009var resultsPerNode = new Dictionary<ProjectGraphNode, BuildResult>(projectGraph.ProjectNodes.Count);
BackEnd\Components\ProjectCache\ProjectCacheDescriptorEqualityComparer.cs (1)
49if (obj.PluginSettings.Count > 0)
BackEnd\Components\SdkResolution\SdkResolverLoader.cs (2)
57if (potentialResolvers.Count == 0) 86MSBuildEventSource.Log.SdkResolverFindResolversManifestsStop(allResolversManifests?.Count ?? 0);
BackEnd\Components\SdkResolution\SdkResolverService.cs (3)
488if (defaultResolvers.Count > 0) 538_specificResolversManifestsRegistry.Count + _generalResolversManifestsRegistry.Count));
BackEnd\Shared\BuildResult.cs (1)
549targetsToKeep.Count > 0,
BuildCheck\Infrastructure\BuildCheckManagerProvider.cs (1)
275check.SupportedRules.Count != checkFactoryContext.RuleIds.Length
BuildCheck\Infrastructure\CheckWrapper.cs (3)
46_ruleTelemetryData = new BuildCheckRuleTelemetryData[check.SupportedRules.Count]; 88CheckConfigurationEffective effectiveConfig = effectiveConfigs[Math.Max(idx, effectiveConfigs.Count - 1)]; 107if (effectiveConfigs.Count == 1)
BuildCheck\Infrastructure\ConfigurationProvider.cs (2)
144TConfig[] configurations = new TConfig[ruleIds.Count]; 145for (int i = 0; i < ruleIds.Count; i++)
BuildCheck\Infrastructure\CustomConfigurationData.cs (2)
72if (customConfigObj.ConfigurationData != null && ConfigurationData != null && ConfigurationData.Count == customConfigObj.ConfigurationData.Count)
CollectionHelpers.cs (2)
60if (a.Count != b.Count)
Construction\Solution\SolutionFile.cs (3)
520return project.ProjectType != SolutionProjectType.SolutionFolder && project.ProjectConfigurations.Count > 0; 1829if ((_defaultConfigurationName.Length == 0) && (SolutionConfigurations.Count > 0)) 1867if ((_defaultPlatformName.Length == 0) && (SolutionConfigurations.Count > 0))
Construction\Solution\SolutionProjectGenerator.cs (3)
737var projectsInOrder = new List<ProjectInSolution>(_solutionFile.ProjectsInOrder.Count); 2324if ((!solutionHasReleaseConfiguration) && (_solutionFile.SolutionConfigurations.Count > 0)) 2349if (_solutionFile.SolutionConfigurations.Count > 0)
ErrorUtilities.cs (2)
511if (parameter.Count == 0) 522if (parameter?.Count == 0)
Evaluation\Profiler\ProfilerResultPrettyPrinter.cs (1)
44if (profiledLocations.Count == 0)
FileMatcher.cs (3)
507if (0 == entries.Count) 519ErrorUtilities.VerifyThrow(entries.Count == 1, 521parts[i], longPath, path, entries.Count);
Graph\GraphBuilder.cs (9)
105var graphRoots = new List<ProjectGraphNode>(entryPointNodes.Count); 109if (entryPointNode.ReferencingProjects.Count == 0) 128if (_solutionDependencies != null && _solutionDependencies.Count != 0) 249if (entryPoints.Count == 0 || !entryPoints.Any(e => FileUtilities.IsSolutionFilename(e.ProjectFile))) 254if (entryPoints.Count != 1) 262ErrorUtilities.VerifyThrowArgument(entryPoints.Count == 1, "StaticGraphAcceptsSingleSolutionEntryPoint"); 311List<ProjectGraphEntryPoint> newEntryPoints = new(projectsInSolution.Count); 339if (project.Dependencies.Count > 0) 343List<string> solutionDependenciesForProject = new(project.Dependencies.Count);
Graph\ProjectGraph.cs (9)
486ProjectNodes.Count, 556return $"#roots={GraphRoots.Count}, #nodes={ProjectNodes.Count}, #entryPoints={EntryPointNodes.Count}"; 563var toposort = new List<ProjectGraphNode>(graphNodes.Count); 564var partialRoots = new Queue<ProjectGraphNode>(graphNodes.Count); 565var inDegree = graphNodes.ToDictionary(n => n, n => n.ReferencingProjects.Count); 587ErrorUtilities.VerifyThrow(toposort.Count == graphNodes.Count, "sorted node count must be equal to total node count"); 717if (node.ProjectReferences.Count == 0)
Graph\ProjectGraphNode.cs (2)
56$"{truncatedProjectFile}, #GlobalProps={ProjectInstance.GlobalProperties.Count}, #Props={ProjectInstance.Properties.Count}, #Items={ProjectInstance.Items.Count}, #in={ReferencingProjects.Count}, #out={ProjectReferences.Count}";
Graph\ProjectInterpretation.cs (1)
252if (outerBuild.ProjectType == ProjectType.OuterBuild && outerBuild.ReferencingProjects.Count != 0)
Logging\BinaryLogger\BuildEventArgsWriter.cs (1)
362Write(result.Value.ProfiledLocations.Count);
LogMessagePacketBase.cs (1)
1032var count = value.ProfiledLocations.Count;
Microsoft.Build.BuildCheck.UnitTests (2)
TaskInvocationAnalysisDataTests.cs (2)
120data.Parameters.Count.ShouldBe(1); 142data.Parameters.Count.ShouldBe(3);
Microsoft.Build.Engine.OM.UnitTests (12)
Construction\SolutionFile_Tests.cs (10)
189Assert.Equal(3, solution.ProjectsInOrder.Count); 271Assert.Equal(3, solution.ProjectsInOrder.Count); 356Assert.Equal(3, solution.ProjectsInOrder.Count); 368Assert.Equal(2, classLibrary2.Dependencies.Count); 437Assert.Equal(7, solution.SolutionConfigurations.Count); 499Assert.Equal(6, solution.SolutionConfigurations.Count); 577Assert.Equal(6, csharpProject.ProjectConfigurations.Count); 597Assert.Equal(6, vcProject.ProjectConfigurations.Count); 662Assert.Equal(2, winFormsApp1.ProjectConfigurations.Count); 670Assert.Equal(2, classLibrary1.ProjectConfigurations.Count);
ErrorUtilities.cs (2)
511if (parameter.Count == 0) 522if (parameter?.Count == 0)
Microsoft.Build.Engine.UnitTests (156)
BackEnd\BuildManager_Tests.cs (2)
4204graph.ProjectNodes.Count.ShouldBe(2); 4289graph.ProjectNodes.Count.ShouldBe(2);
BackEnd\SdkResolverLoader_Tests.cs (5)
80files.Count.ShouldBe(1); 112resolversFound.Count.ShouldBe(1); 235resolversFound.Count.ShouldBe(1); 261resolversManifestsFound.Count.ShouldBe(1); 350resolvers.Count.ShouldBe(0);
Construction\SolutionFile_NewParser_Tests.cs (1)
90solution.ProjectsInOrder[0].Dependencies.Count.ShouldBe(2);
Construction\SolutionFile_OldParser_Tests.cs (11)
981solution.ProjectsInOrder.Count.ShouldBe(4); 1069solution.ProjectsInOrder.Count.ShouldBe(5); 1386solution.ProjectsInOrder.Count.ShouldBe(6); 1466solution.ProjectsInOrder.Count.ShouldBe(3); 1477solution.ProjectsInOrder[1].Dependencies.Count.ShouldBe(2); 1547solution.ProjectsInOrder[0].Dependencies.Count.ShouldBe(2); 1624solution.ProjectsInOrder.Count.ShouldBe(3); 1693solution.SolutionConfigurations.Count.ShouldBe(7); 1753solution.SolutionConfigurations.Count.ShouldBe(6); 1962csProject.ProjectConfigurations.Count.ShouldBe(6); 1982vcProject.ProjectConfigurations.Count.ShouldBe(6);
Graph\GetCompatiblePlatformGraph_Tests.cs (1)
184graph.ProjectNodes.Count.ShouldBe(3);
Graph\GraphLoadedFromSolution_tests.cs (6)
600edges.Count.ShouldBe(1); 623edges.Count.ShouldBe(10); 626node1.ProjectReferences.Count.ShouldBe(3); 631outerBuild3.ProjectReferences.Count.ShouldBe(3); 690graph.ProjectNodes.Count.ShouldBe(graph.ProjectNodes.Select(GetProjectPath).Distinct().Count()); 696if (projectConfigurations == null || graphFromSolution.ProjectNodes.All(n => n.ProjectReferences.Count == 0))
Graph\GraphTestingUtilities.cs (1)
50outerBuild.ProjectReferences.Count.ShouldBe(expectedInnerBuildCount);
Graph\ProjectGraph_Tests.cs (122)
66projectGraph.ProjectNodes.Count.ShouldBe(1); 117projectGraph.ProjectNodes.Count.ShouldBe(1); 232graph.ProjectNodes.Count.ShouldBe(3); 233GetFirstNodeWithProjectNumber(graph, 1).ProjectReferences.Count.ShouldBe(2); 234GetFirstNodeWithProjectNumber(graph, 2).ProjectReferences.Count.ShouldBe(0); 235GetFirstNodeWithProjectNumber(graph, 3).ProjectReferences.Count.ShouldBe(0); 261graph.ProjectNodes.Count.ShouldBe(7); 270node1.ProjectReferences.Count.ShouldBe(2); 271node2.ProjectReferences.Count.ShouldBe(3); 272node3.ProjectReferences.Count.ShouldBe(0); 273node4.ProjectReferences.Count.ShouldBe(0); 274node5.ProjectReferences.Count.ShouldBe(1); 275node6.ProjectReferences.Count.ShouldBe(1); 276node7.ProjectReferences.Count.ShouldBe(0); 278node1.ReferencingProjects.Count.ShouldBe(1); 279node2.ReferencingProjects.Count.ShouldBe(0); 280node3.ReferencingProjects.Count.ShouldBe(1); 281node4.ReferencingProjects.Count.ShouldBe(1); 282node5.ReferencingProjects.Count.ShouldBe(2); 283node6.ReferencingProjects.Count.ShouldBe(1); 284node7.ReferencingProjects.Count.ShouldBe(1); 406graph.ProjectNodes.Count.ShouldBe(5); 431graph.ProjectNodes.Count.ShouldBe(3); 464graph.ProjectNodes.Count.ShouldBe(6); 470node4A.ProjectReferences.Count.ShouldBe(1); 471node4B.ProjectReferences.Count.ShouldBe(1); 500graph.ProjectNodes.Count.ShouldBe(4); 535graph.ProjectNodes.Count.ShouldBe(6); 579projectGraph.ProjectNodes.Count.ShouldBe(3); 584node1.ProjectReferences.Count.ShouldBe(1); 586node2.ProjectReferences.Count.ShouldBe(1); 602projectGraph.ProjectNodes.Count.ShouldBe(4); 604projectGraph.EntryPointNodes.Count.ShouldBe(2); 616entryPointNode1.ProjectReferences.Count.ShouldBe(1); 617entryPointNode2.ProjectReferences.Count.ShouldBe(1); 641projectGraph.ProjectNodes.Count.ShouldBe(3); 643projectGraph.EntryPointNodes.Count.ShouldBe(2); 655entryPointNode1.ProjectReferences.Count.ShouldBe(1); 656entryPointNode2.ProjectReferences.Count.ShouldBe(1); 674projectGraph.EntryPointNodes.Count.ShouldBe(3); 675projectGraph.GraphRoots.Count.ShouldBe(2); 862projectGraph.EntryPointNodes.Count.ShouldBe(5); 864projectGraph.GraphRoots.Count.ShouldBe(2); 866projectGraph.ProjectNodes.Count.ShouldBe(7); 871project1Node.ProjectReferences.Count.ShouldBe(3); 877project2Node.ProjectReferences.Count.ShouldBe(1); 883project3Node.ProjectReferences.Count.ShouldBe(1); 890project4Node.ProjectReferences.Count.ShouldBe(0); 896project5Node.ProjectReferences.Count.ShouldBe(0); 902project6Node.ProjectReferences.Count.ShouldBe(0); 910project8Node.ProjectReferences.Count.ShouldBe(0); 925projectGraph.ProjectNodes.Count.ShouldBe(4); 928targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 953projectGraph.ProjectNodes.Count.ShouldBe(3); 956targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 984projectGraph.ProjectNodes.Count.ShouldBe(6); 987targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1006projectGraph.ProjectNodes.Count.ShouldBe(2); 1009targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1024projectGraph.ProjectNodes.Count.ShouldBe(2); 1027targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1047projectGraph.ProjectNodes.Count.ShouldBe(2); 1050targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1070projectGraph.ProjectNodes.Count.ShouldBe(2); 1073targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1087projectGraph.ProjectNodes.Count.ShouldBe(1); 1113projectGraph.ProjectNodes.Count.ShouldBe(2); 1116targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1154projectGraph.ProjectNodes.Count.ShouldBe(2); 1157targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1188projectGraph.ProjectNodes.Count.ShouldBe(4); 1192targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1360projectGraph.ProjectNodes.Count.ShouldBe(12); 1364targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1395projectGraph.ProjectNodes.Count.ShouldBe(2); 1398targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1418projectGraph.ProjectNodes.Count.ShouldBe(2); 1421targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1448projectGraph.ProjectNodes.Count.ShouldBe(7); 1451targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); 1505projectGraph.ProjectNodes.Count.ShouldBe(expected: 5); 1508targetLists.Count.ShouldBe(expected: projectGraph.ProjectNodes.Count); 1815toposort.Length.ShouldBe(projectGraph.ProjectNodes.Count); 1876Regex.Matches(dot, "label").Count.ShouldBe(graph.ProjectNodes.Count); 1888graph.ProjectNodes.Count.ShouldBe(3); 1915graph.ProjectNodes.Count.ShouldBe(4); 1949graph.ProjectNodes.Count.ShouldBe(4); 1982graph.ProjectNodes.Count.ShouldBe(4); 2001graph.ProjectNodes.Count.ShouldBe(4); 2029graph.ProjectNodes.Count.ShouldBe(2); 2048graph.ProjectNodes.Count.ShouldBe(2); 2069graph.ProjectNodes.Count.ShouldBe(8); 2096graph.ProjectNodes.Count.ShouldBe(11); 2107innerBuildWithCommonReferences.ProjectReferences.Count.ShouldBe(4); 2113innerBuildWithAdditionalReferences.ProjectReferences.Count.ShouldBe(8); 2136graph.ProjectNodes.Count.ShouldBe(4); 2170graph.ProjectNodes.Count.ShouldBe(3); 2214graph.ProjectNodes.Count.ShouldBe(5); 2538innerBuilds1.Count.ShouldBe(2); 2550innerBuilds4.Count.ShouldBe(2); 2625innerBuildsFor1.Count.ShouldBe(2); 2638innerBuildsFor2.Count.ShouldBe(2); 2648outerBuild3.ReferencingProjects.Count.ShouldBe(4); 2652innerBuildsFor3.Count.ShouldBe(2); 2656inner3.ReferencingProjects.Count.ShouldBe(5); 2878targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count);
Graph\ResultCacheBasedBuilds_Tests.cs (1)
437var results = new Dictionary<string, (BuildResult Result, MockLogger Logger)>(topoSortedNodes.Count);
ProjectCache\ProjectCacheTests.cs (4)
785instanceMockCache.Requests.Count.ShouldBe(graph.ProjectNodes.Count); 791Regex.Matches(mockLogger.FullLog, $"{AssemblyMockCache}: GetCacheResultAsync for").Count.ShouldBe(graph.ProjectNodes.Count); 1504StringShouldContainSubstring(logger.FullLog, $"{AssemblyMockCache}: GetCacheResultAsync for", graph.ProjectNodes.Count); 1547cache.QueryStartStops.Count.ShouldBe(graph.ProjectNodes.Count * 2);
SolutionFileBuilder.cs (2)
156if (project.Dependencies.Count > 0 || project.DependencyGuids.Count > 0)
Microsoft.Build.Framework (4)
BuildSubmissionStartedEventArgs.cs (1)
57writer.Write(GlobalProperties.Count);
FileClassifier.cs (1)
327for (int i = 0; i < immutableDirectories.Count; i++)
Profiler\ProfilerResult.cs (2)
37(ProfiledLocations.Count == result.ProfiledLocations.Count &&
Microsoft.Build.Tasks.Core (9)
AssemblyDependency\ResolveAssemblyReference.cs (2)
2716var combined = new List<DependentAssembly>(first.Count + second.Count);
ErrorUtilities.cs (2)
511if (parameter.Count == 0) 522if (parameter?.Count == 0)
FileMatcher.cs (3)
507if (0 == entries.Count) 519ErrorUtilities.VerifyThrow(entries.Count == 1, 521parts[i], longPath, path, entries.Count);
WriteCodeFragment.cs (2)
399for (int i = 0; i < parameters.Count; i++) 482.Where(t => t.Length == positionalParameters.Count)
Microsoft.Build.Tasks.UnitTests (1)
ResourceHandling\MSBuildResXReader_Tests.cs (1)
105resxWithTwoStrings.Count.ShouldBe(2);
Microsoft.Build.UnitTests.Shared (1)
ObjectModelHelpers.cs (1)
1304a.Count.ShouldBe(b.Count);
Microsoft.Build.Utilities.Core (5)
ErrorUtilities.cs (2)
511if (parameter.Count == 0) 522if (parameter?.Count == 0)
FileMatcher.cs (3)
507if (0 == entries.Count) 519ErrorUtilities.VerifyThrow(entries.Count == 1, 521parts[i], longPath, path, entries.Count);
Microsoft.CodeAnalysis (72)
Collections\CollectionsExtensions.cs (1)
20return collection == null || collection.Count == 0;
CommandLine\AnalyzerConfigSet.cs (1)
128var sortedAnalyzerConfigs = ArrayBuilder<AnalyzerConfig>.GetInstance(analyzerConfigs.Count);
CommandLine\SarifV1ErrorLogger.cs (1)
109additionalLocations.Count > 0 &&
CommandLine\SarifV2ErrorLogger.cs (1)
148additionalLocations.Count > 0 &&
Diagnostic\Diagnostic.cs (1)
500if (AdditionalLocations is null || AdditionalLocations.Count == 0)
Emit\EditAndContinue\DeltaMetadataWriter.cs (19)
149sizes[(int)TableIndex.TypeRef] = _typeRefIndex.Rows.Count; 150sizes[(int)TableIndex.TypeDef] = _typeDefs.GetAdded().Count; 151sizes[(int)TableIndex.Field] = _fieldDefs.GetAdded().Count; 152sizes[(int)TableIndex.MethodDef] = _methodDefs.GetAdded().Count; 153sizes[(int)TableIndex.Param] = _parameterDefs.GetAdded().Count; 154sizes[(int)TableIndex.MemberRef] = _memberRefIndex.Rows.Count; 155sizes[(int)TableIndex.StandAloneSig] = _standAloneSignatureIndex.Rows.Count; 156sizes[(int)TableIndex.EventMap] = _eventMap.GetAdded().Count; 157sizes[(int)TableIndex.Event] = _eventDefs.GetAdded().Count; 158sizes[(int)TableIndex.PropertyMap] = _propertyMap.GetAdded().Count; 159sizes[(int)TableIndex.Property] = _propertyDefs.GetAdded().Count; 160sizes[(int)TableIndex.MethodImpl] = _methodImpls.GetAdded().Count; 161sizes[(int)TableIndex.ModuleRef] = _moduleRefIndex.Rows.Count; 162sizes[(int)TableIndex.TypeSpec] = _typeSpecIndex.Rows.Count; 163sizes[(int)TableIndex.AssemblyRef] = _assemblyRefIndex.Rows.Count; 164sizes[(int)TableIndex.GenericParam] = _genericParameters.GetAdded().Count; 165sizes[(int)TableIndex.MethodSpec] = _methodSpecIndex.Rows.Count; 254if (previous.Count == 0) 259if (current.Count == 0)
Emit\EditAndContinue\EmitBaseline.cs (7)
343Debug.Assert(tableEntriesAdded[(int)TableIndex.TypeDef] >= typesAdded.Count); 344Debug.Assert(tableEntriesAdded[(int)TableIndex.Event] >= eventsAdded.Count); 345Debug.Assert(tableEntriesAdded[(int)TableIndex.Field] >= fieldsAdded.Count); 346Debug.Assert(tableEntriesAdded[(int)TableIndex.MethodDef] >= methodsAdded.Count); 347Debug.Assert(tableEntriesAdded[(int)TableIndex.Property] >= propertiesAdded.Count); 348Debug.Assert(tableEntriesAdded[(int)TableIndex.EventMap] >= eventMapAdded.Count); 349Debug.Assert(tableEntriesAdded[(int)TableIndex.PropertyMap] >= propertyMapAdded.Count);
Emit\EditAndContinue\SymbolMatcher.cs (1)
171if (previousMembers.Count == 0)
InternalUtilities\EnumerableExtensions.cs (7)
281return readOnlyCollection.Count == 0; 309return source.Count == 0; 389var builder = new TResult[source.Count]; 405var builder = new TResult[source.Count]; 446var builder = ArrayBuilder<TResult>.GetInstance(source.Count); 459var builder = ArrayBuilder<TResult>.GetInstance(source.Count); 598for (int i = 0, length = list.Count; i < length; i++)
InternalUtilities\IReadOnlyListExtensions.cs (1)
14for (int i = 0; i < list.Count; i++)
PEWriter\MetadataWriter.cs (16)
1956metadata.SetCapacity(TableIndex.AssemblyRef, assemblyRefs.Count); 2207metadata.SetCapacity(TableIndex.Event, eventDefs.Count); 2368metadata.SetCapacity(TableIndex.Field, fieldDefs.Count); 2576metadata.SetCapacity(TableIndex.MemberRef, memberRefs.Count); 2603metadata.SetCapacity(TableIndex.MethodSpec, methodSpecs.Count); 2616metadata.SetCapacity(TableIndex.MethodDef, methodDefs.Count); 2639metadata.SetCapacity(TableIndex.MethodSemantics, propertyDefs.Count * 2 + eventDefs.Count * 2); 2701metadata.SetCapacity(TableIndex.ModuleRef, moduleRefs.Count); 2741metadata.SetCapacity(TableIndex.Param, parameterDefs.Count); 2755metadata.SetCapacity(TableIndex.Property, propertyDefs.Count); 2769metadata.SetCapacity(TableIndex.TypeDef, typeDefs.Count); 2826metadata.SetCapacity(TableIndex.TypeRef, typeRefs.Count); 2886metadata.SetCapacity(TableIndex.TypeSpec, typeSpecs.Count); 2908int[] bodyOffsets = new int[methods.Count]; 2940int[] bodyOffsets = new int[methods.Count];
ReferenceManager\CommonReferenceManager.Binding.cs (1)
971for (int i = 1; i < referenceBindings.Count; i++)
src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoEncoder.cs (6)
87Debug.Assert(groupSizes.Count <= ushort.MaxValue); 91if (groupSizes.Count == 0) 101builder.WriteUInt16((ushort)uc.Count); 152builder.WriteInt32(infos.Count); 178Debug.Assert(infos.Count > 0); 180builder.WriteInt32(infos.Count);
Syntax\GreenNode.cs (2)
935switch (list.Count) 947var array = new ArrayElement<GreenNode>[list.Count];
Text\ChangedText.cs (4)
193if (changes.Count > 1) 200if (actualOldText != null && actualOldText.GetChangeRanges(oldText).Count == 0) 254Debug.Assert(changeSets.Count > 1); 257for (int i = 1; i < changeSets.Count; i++)
Text\CompositeText.cs (1)
374for (int i = 0; i < segments.Count; i++)
Text\TextChangeRangeExtensions.cs (2)
18if (changesInNextVersion.Count == 0) 27var newChange = changesInNextVersion.Count == 1
Microsoft.CodeAnalysis.CodeStyle (22)
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (1)
138for (var index = 0; index < triviaList.Count; index++)
src\Compilers\Core\Portable\InternalUtilities\EnumerableExtensions.cs (7)
281return readOnlyCollection.Count == 0; 309return source.Count == 0; 389var builder = new TResult[source.Count]; 405var builder = new TResult[source.Count]; 446var builder = ArrayBuilder<TResult>.GetInstance(source.Count); 459var builder = ArrayBuilder<TResult>.GetInstance(source.Count); 598for (int i = 0, length = list.Count; i < length; i++)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (2)
18if (changesInNextVersion.Count == 0) 27var newChange = changesInNextVersion.Count == 1
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamespaceOrTypeSymbolExtensions.cs (4)
44for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++) 71return names1.Count - names2.Count;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\AbstractSyntaxFormatting.cs (1)
45if (spansToFormat.Count == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (3)
49Contract.ThrowIfFalse(spans.Count > 0); 51if (spans.Count == 1) 61for (var i = 1; i < spans.Count; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\IReadOnlyListExtensions.cs (2)
23=> list[list.Count - 1]; 27for (var index = startIndex; index < list.Count; index++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PublicContract.cs (1)
112var length = list.Count;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (1)
92var result = new FixedSizeArrayBuilder<TResult>(tasks.Count);
Microsoft.CodeAnalysis.CodeStyle.Fixes (12)
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
120var insertionIndex = newParameterIndex ?? existingParameters.Count; 141if (method.MethodKind == MethodKind.ReducedExtension && insertionIndex < existingParameters.Count)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (2)
169if (statements.Count > 0) 171return semanticModel.AnalyzeControlFlow(statements[0], statements[statements.Count - 1]);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (4)
38if (insertionIndex >= existingParameters.Count) 44syntaxFacts, existingParameters[existingParameters.Count - 1], includeLeadingNewLine: true); 154if (parameters.Count <= 1) 160for (int i = 1, n = parameters.Count; i < n; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.cs (2)
101if (statementIndex + 1 < state.OutermostBlockStatements.Count && 148if (statementIndex + 1 < state.OutermostBlockStatements.Count)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (2)
82if (textChanges.Count > 1 || 83textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Microsoft.CodeAnalysis.CSharp (11)
BoundTree\UnboundLambda.cs (2)
1420var nx = x.Arguments?.Count ?? 0; 1421var ny = y.Arguments?.Count ?? 0;
Compiler\MethodCompiler.cs (2)
1231if (capturedParameters.Count != 0) 1235var initializers = ArrayBuilder<BoundStatement>.GetInstance(capturedParameters.Count);
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (1)
145var builder = ArrayBuilder<BoundExpression>.GetInstance(bytes.Count + 1);
Symbols\Source\SourceMemberContainerSymbol.cs (1)
4256var members = ArrayBuilder<Symbol>.GetInstance(membersSoFar.Count + 1);
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (3)
115if (capturedParameters.Count == 0) 214int count = oldSet.Count; 215Debug.Assert(count == value.Count);
Syntax\CSharpSyntaxTree.cs (2)
541if (changes.Count == 0 && newText == oldText) 564if (workingChanges.Count == 1 && workingChanges[0].Span == new TextSpan(0, this.Length) && workingChanges[0].NewLength == newText.Length)
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (2)
239while (index + 1 < statements.Count && statements[index + 1] is LocalFunctionStatementSyntax) 243if (index == statements.Count - 1)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (3)
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (2)
69var references = new List<ExpressionSyntax>(diagnostic.AdditionalLocations.Count - 2); 71for (var i = 2; i < diagnostic.AdditionalLocations.Count; i++)
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
92for (var i = 0; i < list.Count; i++)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
CodeActions\PreviewTests.cs (1)
76var removedReference = _oldDocument.Project.MetadataReferences[_oldDocument.Project.MetadataReferences.Count - 1];
Workspaces\WorkspaceTests_EditorFeatures.cs (1)
1057Assert.Equal(1, project.AdditionalDocumentIds.Count);
Microsoft.CodeAnalysis.CSharp.Features (10)
AddImport\CSharpAddImportFeatureService.cs (1)
397CreateNameSyntax(namespaceParts, namespaceParts.Count - 1));
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (2)
239while (index + 1 < statements.Count && statements[index + 1] is LocalFunctionStatementSyntax) 243if (index == statements.Count - 1)
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
159for (var i = declarationIndex + 1; i < statements.Count; i++)
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (2)
69var references = new List<ExpressionSyntax>(diagnostic.AdditionalLocations.Count - 2); 71for (var i = 2; i < diagnostic.AdditionalLocations.Count; i++)
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (3)
73if (originalBlockStatements.Count == currentBlockStatements.Count) 92for (var i = 0; i < list.Count; i++)
Wrapping\SeparatedSyntaxList\CSharpParameterWrapper.cs (1)
63var firstToken = attributes?.Count > 0
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (2)
Parsing\LocalFunctionParsingTests.cs (2)
1293Assert.Equal(0, file.SyntaxTree.Options.Features.Count); 1345Assert.Equal(0, file.SyntaxTree.Options.Features.Count);
Microsoft.CodeAnalysis.CSharp.Workspaces (10)
CodeGeneration\CSharpSyntaxGenerator.cs (10)
1035if (index >= 0 && index < existingAttributes.Count) 1039else if (existingAttributes.Count > 0) 1041return this.InsertNodesAfter(declaration, existingAttributes[existingAttributes.Count - 1], WithRequiredTargetSpecifier(newAttributes, declaration)); 1070if (index >= 0 && index < existingAttributes.Count) 1074else if (existingAttributes.Count > 0) 1076return this.InsertNodesAfter(d, existingAttributes[existingAttributes.Count - 1], newAttributes); 1352if (index >= 0 && index < existingMembers.Count) 1356else if (existingMembers.Count > 0) 1358return this.InsertNodesAfter(declaration, existingMembers[existingMembers.Count - 1], newMembers); 2911var count = subDecls.Count;
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (65)
CodeGeneration\SyntaxGeneratorTests.cs (65)
1973Assert.Equal(1, attrsAdded.Count); 2643=> Assert.Equal(0, Generator.GetNamespaceImports(Generator.RemoveNodes(declaration, Generator.GetNamespaceImports(declaration))).Count); 2851=> Assert.Equal(0, Generator.GetMembers(Generator.RemoveNodes(declaration, Generator.GetMembers(declaration))).Count); 3236Assert.Equal(0, Generator.GetParameters(Generator.MethodDeclaration("m")).Count); 3237Assert.Equal(1, Generator.GetParameters(Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3238Assert.Equal(2, Generator.GetParameters(Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))])).Count); 3240Assert.Equal(0, Generator.GetParameters(Generator.ConstructorDeclaration()).Count); 3241Assert.Equal(1, Generator.GetParameters(Generator.ConstructorDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3242Assert.Equal(2, Generator.GetParameters(Generator.ConstructorDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))])).Count); 3247Assert.Equal(0, Generator.GetParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr"))).Count); 3248Assert.Equal(1, Generator.GetParameters(Generator.ValueReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count); 3250Assert.Equal(0, Generator.GetParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr"))).Count); 3251Assert.Equal(1, Generator.GetParameters(Generator.VoidReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count); 3253Assert.Equal(0, Generator.GetParameters(Generator.DelegateDeclaration("d")).Count); 3254Assert.Equal(1, Generator.GetParameters(Generator.DelegateDeclaration("d", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3256Assert.Equal(0, Generator.GetParameters(Generator.ClassDeclaration("c")).Count); 3257Assert.Equal(0, Generator.GetParameters(Generator.IdentifierName("x")).Count); 3263Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.MethodDeclaration("m"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3264Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ConstructorDeclaration(), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3267Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr")), [Generator.LambdaParameter("p")])).Count); 3268Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr")), [Generator.LambdaParameter("p")])).Count); 3270Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.DelegateDeclaration("d"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3272Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ClassDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3273Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.StructDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3274Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.InterfaceDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3275Assert.Equal(0, Generator.GetParameters(Generator.AddParameters(Generator.IdentifierName("x"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3288Assert.Equal(1, Generator.GetStatements(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")])).Count); 3353Assert.Equal(2, Generator.GetAccessors(prop).Count); 3378Assert.Equal(0, Generator.GetStatements(getAccessor).Count); 3379Assert.Equal(0, Generator.GetStatements(setAccessor).Count); 3452Assert.Equal(2, Generator.GetAccessors(x).Count); 3453Assert.Equal(0, Generator.GetAccessors(y).Count); 3458Assert.Equal(0, Generator.GetAccessors(y2).Count); 3473Assert.Equal(2, Generator.GetAccessors(x).Count); 3474Assert.Equal(0, Generator.GetAccessors(y).Count); 3479Assert.Equal(0, Generator.GetAccessors(y2).Count); 3541Assert.Equal(0, Generator.GetStatements(Generator.MethodDeclaration("m")).Count); 3542Assert.Equal(2, Generator.GetStatements(Generator.MethodDeclaration("m", statements: stmts)).Count); 3544Assert.Equal(0, Generator.GetStatements(Generator.ConstructorDeclaration()).Count); 3545Assert.Equal(2, Generator.GetStatements(Generator.ConstructorDeclaration(statements: stmts)).Count); 3548Assert.Equal(2, Generator.GetStatements(Generator.VoidReturningLambdaExpression(stmts)).Count); 3551Assert.Equal(2, Generator.GetStatements(Generator.ValueReturningLambdaExpression(stmts)).Count); 3553Assert.Equal(0, Generator.GetStatements(Generator.IdentifierName("x")).Count); 3568Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.MethodDeclaration("m"), stmts)).Count); 3569Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ConstructorDeclaration(), stmts)).Count); 3573Assert.Equal(0, Generator.GetStatements(Generator.WithStatements(Generator.IdentifierName("x"), stmts)).Count); 3591Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count); 3592Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), getAccessorStatements: stmts)).Count); 3597Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.IdentifierName("x")).Count); 3600Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count); 3601Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), setAccessorStatements: stmts)).Count); 3606Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.IdentifierName("x")).Count); 3624Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count); 3626Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count); 3629Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count); 3631Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count); 3644Assert.Equal(2, baseListBI.Count); 3655Assert.Equal(1, baseListB.Count); 3842Assert.Equal(1, Generator.GetAttributes(xAttributed).Count); 3846Assert.Equal(3, membersC.Count); 4137Assert.Equal(3, attrs.Count); 4310Assert.Equal(0, Generator.GetAttributes(declM).Count); 4313Assert.Equal(3, attrs.Count); 4403Assert.Equal(4, attrs.Count); 4422Assert.Equal(4, rattrs.Count);
Microsoft.CodeAnalysis.Debugging.Package (6)
CustomDebugInfoEncoder.cs (6)
87Debug.Assert(groupSizes.Count <= ushort.MaxValue); 91if (groupSizes.Count == 0) 101builder.WriteUInt16((ushort)uc.Count); 152builder.WriteInt32(infos.Count); 178Debug.Assert(infos.Count > 0); 180builder.WriteInt32(infos.Count);
Microsoft.CodeAnalysis.EditorFeatures (12)
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (9)
343Debug.Assert(matchResults.Count > 0); 370for (var i = 1; i < matchResults.Count; ++i) 395for (selectedItemIndex = 0; selectedItemIndex < matchResults.Count; ++selectedItemIndex) 401Debug.Assert(selectedItemIndex < matchResults.Count); 490for (var i = 0; i < items.Count; ++i) 682Debug.Assert(filteredMatchResults.Count > 0); 687for (int i = 1, n = filteredMatchResults.Count; i < n; i++) 865inferiorItemIndex = matches.Count; 881while (++inferiorItemIndex < matches.Count)
Structure\StructureTag.cs (3)
81Hash.Combine(this.SubHeadings?.Count ?? 0, this.GuideLineSpan.GetHashCode())))))))); 103if (this.SubHeadings.Count != other.SubHeadings.Count) 106for (int i = 0, n = this.SubHeadings.Count; i < n; i++)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Completion\AbstractCompletionProviderTests.cs (1)
202Assert.Equal(items.Count, 0);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (12)
Preview\PreviewWorkspaceTests.cs (5)
61Assert.Equal(0, previewWorkspace.CurrentSolution.ProjectIds.Count); 76Assert.Equal(1, previewWorkspace.CurrentSolution.Projects.First().MetadataReferences.Count); 77Assert.Equal(1, previewWorkspace.CurrentSolution.Projects.First().DocumentIds.Count); 89Assert.Equal(0, previewWorkspace.CurrentSolution.Projects.First().MetadataReferences.Count); 90Assert.Equal(0, previewWorkspace.CurrentSolution.Projects.First().DocumentIds.Count);
Tagging\TagSpanIntervalTreeTests.cs (7)
87Assert.Equal(50, GetIntersectingSpans(tree, new SnapshotSpan(buffer.CurrentSnapshot, 150, 50)).Count); 90Assert.Equal(26, GetIntersectingSpans(tree, new SnapshotSpan(buffer.CurrentSnapshot, 175, 25)).Count); 101Assert.Equal(1, GetIntersectingSpans(tree, new SnapshotSpan(buffer.CurrentSnapshot, 0, 1)).Count); 102Assert.Equal(1, GetIntersectingSpans(tree, new SnapshotSpan(buffer.CurrentSnapshot, 50, 1)).Count); 105Assert.Equal(2, GetIntersectingSpans(tree, new SnapshotSpan(buffer.CurrentSnapshot, 100, 1)).Count); 119Assert.Equal(51, GetIntersectingSpans(tree, new SnapshotSpan(buffer.CurrentSnapshot, 0, 1)).Count); 133Assert.Equal(51, GetIntersectingSpans(tree, new SnapshotSpan(buffer.CurrentSnapshot, 99, 1)).Count);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
NavigateTo\NavigateToItemProvider.cs (1)
102if (kinds == null || kinds.Count == 0)
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (2)
IntelliSense\CompletionServiceTests.vb (1)
43Assert.True(list.ItemsList.Count = 1, "Completion list contained more than one item")
IntelliSense\CompletionServiceTests_Exclusivitiy.vb (1)
48Assert.True(list.ItemsList.Count = 2, "Completion List does not contain exactly two items.")
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (1)
ResultProviderTestBase.cs (1)
353int n = actual.Count;
Microsoft.CodeAnalysis.Features (53)
AddImport\AbstractAddImportFeatureService.cs (2)
145var projectToAssembly = new ConcurrentDictionary<Project, AsyncLazy<IAssemblySymbol>>(concurrencyLevel: 2, capacity: project.Solution.ProjectIds.Count); 146var referenceToCompilation = new ConcurrentDictionary<PortableExecutableReference, Compilation>(concurrencyLevel: 2, capacity: project.Solution.Projects.Sum(p => p.MetadataReferences.Count));
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (1)
591if (refLocations.Count > 0)
Completion\CompletionList.cs (1)
188internal bool IsEmpty => ItemsList.Count == 0 && SuggestionModeItem is null;
Completion\Providers\AbstractAggregateEmbeddedLanguageCompletionProvider.cs (2)
96var count = context.Items.Count; 99if (context.Items.Count > count)
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (1)
164if (context.Items.Count > 0)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (1)
2508if (editScript.Edits.Length == 0 && triviaEdits.Count == 0)
EditAndContinue\DeclarationBodyMap.cs (2)
29Contract.ThrowIfFalse(forwardMatch.Count == reverseMatch.Count);
EditAndContinue\EditSession.cs (5)
687using var _0 = ArrayBuilder<SemanticEdit>.GetInstance(edits.Count, out var mergedEditsBuilder); 689using var _2 = ArrayBuilder<(ISymbol? oldSymbol, ISymbol? newSymbol)>.GetInstance(edits.Count, out var resolvedSymbols); 724for (var i = 0; i < edits.Count; i++) 748if (edits.Count == mergedEditsBuilder.Count) 789for (var i = 0; i < edits.Count; i++)
EditAndContinue\Utilities\BidirectionalMap.cs (7)
21Contract.ThrowIfFalse(forward.Count == reverse.Count); 28var forward = new Dictionary<T, T>(Forward.Count + 1); 29var reverse = new Dictionary<T, T>(Reverse.Count + 1); 44if (map.Forward.Count == 0) 49var count = Forward.Count + map.Forward.Count;
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (1)
120var sortText = context.Items.Count.ToString("0000");
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (1)
112var sortText = context.Items.Count.ToString("0000");
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.cs (1)
624count += project.DocumentIds.Count;
NavigateTo\RoslynNavigateToItem.cs (4)
251var activeDiff = activeFolders.Count - commonCount; 252var itemDiff = itemFolders.Count - commonCount; 263var maxCommon = Math.Min(activeFolders.Count, itemFolders.Count);
SplitOrMergeIfStatements\AbstractMergeIfStatementsCodeRefactoringProvider.cs (3)
95while (statements.Count == 1 && blockFacts.IsScopeBlock(statements[0])) 117blockFacts.GetExecutableBlockStatements(parent).Count == statements.Count)
SplitOrMergeIfStatements\Consecutive\AbstractMergeConsecutiveIfStatementsCodeRefactoringProvider.cs (2)
206if (insideStatements.Count == 0) 220var controlFlow = semanticModel.AnalyzeControlFlow(insideStatements[0], insideStatements[insideStatements.Count - 1]);
SplitOrMergeIfStatements\Consecutive\AbstractSplitIntoConsecutiveIfStatementsCodeRefactoringProvider.cs (2)
137if (insideStatements.Count == 0) 152var controlFlow = semanticModel.AnalyzeControlFlow(insideStatements[0], insideStatements[insideStatements.Count - 1]);
SplitOrMergeIfStatements\Nested\AbstractMergeNestedIfStatementsCodeRefactoringProvider.cs (6)
102if (statements.Count > 0 && statements[0] == statement) 105if (rootStatements.Count > 0 && ifGenerator.IsIfOrElseIf(rootStatements[0].Parent)) 133if (statements.Count > 0 && ifGenerator.IsIfOrElseIf(statements[0])) 176if (statements.Count == 1) 216if (!remainingStatements.SequenceEqual(remainingOuterStatements.Take(statements.Count - 1), syntaxFacts.AreEquivalent)) 222var controlFlow = semanticModel.AnalyzeControlFlow(statements[0], statements[statements.Count - 1]);
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (1)
138for (var index = 0; index < triviaList.Count; index++)
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
120var insertionIndex = newParameterIndex ?? existingParameters.Count; 141if (method.MethodKind == MethodKind.ReducedExtension && insertionIndex < existingParameters.Count)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (2)
169if (statements.Count > 0) 171return semanticModel.AnalyzeControlFlow(statements[0], statements[statements.Count - 1]);
src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoEncoder.cs (6)
87Debug.Assert(groupSizes.Count <= ushort.MaxValue); 91if (groupSizes.Count == 0) 101builder.WriteUInt16((ushort)uc.Count); 152builder.WriteInt32(infos.Count); 178Debug.Assert(infos.Count > 0); 180builder.WriteInt32(infos.Count);
Microsoft.CodeAnalysis.LanguageServer.Protocol (9)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs (1)
174var count = documentAnalysisScope != null ? 1 : project.DocumentIds.Count + 1;
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.StateManager.ProjectStates.cs (1)
77if (project.AnalyzerReferences.Count == 0)
Handler\Completion\CompletionHandler.cs (3)
211if (completionListMaxSize < 0 || completionListMaxSize >= completionList.ItemsList.Count) 258? completionList.ItemsList.Count > newCompletionList.ItemsList.Count
Handler\Completion\CompletionResultFactory.cs (1)
46if (list.ItemsList.Count == 0)
Protocol\Converters\SumConverter.cs (3)
199if (applicableUnionTypeInfos.Count > 0) 209for (var i = 0; i < applicableUnionTypeInfos.Count; i++) 226for (var i = 0; i < applicableUnionTypeInfos.Count; i++)
Microsoft.CodeAnalysis.Remote.ServiceHub (3)
Host\RemoteWorkspace.cs (1)
275using var _ = ArrayBuilder<ProjectInfo>.GetInstance(solutionInfo.Projects.Count, out var projectInfos);
Host\RemoteWorkspace.SolutionCreator.cs (1)
130Debug.Assert(solution.ProjectIds.Count == newVersions.Map.Count);
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (1)
392unitCount += _project.DocumentIds.Count;
Microsoft.CodeAnalysis.Test.Utilities (1)
Diagnostics\DiagnosticDescription.cs (1)
171if (args == null || args.Count == 0)
Microsoft.CodeAnalysis.UnitTests (42)
Collections\ImmutableDictionaryTestBase.cs (7)
46Assert.Equal(2, map.Count); 49Assert.Equal(2, map.Count); 66Assert.Equal(2, map.Count); 74Assert.Equal(3, map.Count); 84Assert.Equal(3, map.Count); 93Assert.Equal(2, map.Count); 241Assert.Equal(0, empty.Count);
Collections\ImmutableDictionaryTestBase.nonnetstandard.cs (6)
93Assert.Equal(100, map.Count); 149Assert.Equal(10, map.Count); 163Assert.Equal(10, map.Count); 180Assert.Equal(inputs.Length, map.Count); 191Assert.Equal(0, map.Count); 203Assert.Equal(1, halfRemoved.Count);
Collections\ImmutableSegmentedListTest.cs (4)
376Assert.Equal(9, list2.Count); 380Assert.Equal(8, list2.Count); 384Assert.Equal(7, list2.Count); 388Assert.Equal(5, list2.Count);
Collections\ImmutableSetTest.cs (12)
226Assert.Equal(1, set.Count); 269Assert.Equal(expectedValues.Length, set.Count); 289Assert.Equal(0, emptySet.Count); //, "Empty set should have a Count of 0"); 394int initialCount = set.Count; 400Assert.Equal(initialCount - removedCount, set.Count); 401Assert.Equal(initialCount - removedCount - 1, nextSet.Count); 408Assert.Equal(initialCount - removedCount, set.Count); 490int initialCount = set.Count; 494Assert.Equal(initialCount + uniqueValues.Count, enumerateAddSet.Count); 505Assert.True(nextSet.Count > 0); 506Assert.Equal(initialCount + addedCount, set.Count); 512Assert.Equal(expectedCount, nextSet.Count);
Collections\ImmutableSetTest.nonnetstandard.cs (1)
139Assert.True(set.Intersect(Enumerable.Empty<T>()).Count == 0);
Collections\SegmentedArrayTests.cs (2)
61Assert.Equal(0, ((IReadOnlyCollection<IntPtr>)data).Count); 133Assert.Equal(length, ((IReadOnlyCollection<IntPtr>)data).Count);
Text\TextChangeTests.cs (10)
77Assert.Equal(1, changes.Count); 662Assert.Equal(1, changes.Count); 718Assert.Equal(1, changes.Count); 732Assert.Equal(1, changes.Count); 746Assert.Equal(1, changes.Count); 852Assert.Equal(1, changes.Count); 866Assert.Equal(2, changes.Count); 882Assert.Equal(2, changes.Count); 899Assert.Equal(1, changes.Count); 917Assert.Equal(1, changes.Count);
Microsoft.CodeAnalysis.VisualBasic (1)
Binding\Binder_XmlLiterals.vb (1)
1431Debug.Assert(namespaces.Count > 0)
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (3)
CommandLineArgumentsTests.vb (2)
230Assert.Equal(1, dict.Count) 264Assert.Equal(1, dict.Count)
CommandLineTests.vb (1)
7758Assert.Equal(2, args.ParseOptions.Features.Count)
Microsoft.CodeAnalysis.VisualBasic.Features (1)
Wrapping\SeparatedSyntaxList\VisualBasicParameterWrapper.vb (1)
54Dim firstToken = If(attributes?.Count > 0,
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
SourceGeneration\GeneratorDriverTests.vb (1)
816Assert.Equal(4, diagnostic.Arguments.Count)
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (73)
CodeGeneration\SyntaxGeneratorTests.vb (73)
2292Assert.Equal(1, attrsAdded.Count) 2836Assert.Equal(0, Generator.GetParameters(Generator.MethodDeclaration("m")).Count) 2837Assert.Equal(1, Generator.GetParameters(Generator.MethodDeclaration("m", parameters:={Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count) 2838Assert.Equal(2, Generator.GetParameters(Generator.MethodDeclaration("m", parameters:={Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))})).Count) 2840Assert.Equal(0, Generator.GetParameters(Generator.ConstructorDeclaration()).Count) 2841Assert.Equal(1, Generator.GetParameters(Generator.ConstructorDeclaration(parameters:={Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count) 2842Assert.Equal(2, Generator.GetParameters(Generator.ConstructorDeclaration(parameters:={Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))})).Count) 2844Assert.Equal(0, Generator.GetParameters(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count) 2846Assert.Equal(1, Generator.GetParameters(Generator.IndexerDeclaration({Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))}, Generator.IdentifierName("t"))).Count) 2847Assert.Equal(2, Generator.GetParameters(Generator.IndexerDeclaration({Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))}, Generator.IdentifierName("t"))).Count) 2849Assert.Equal(0, Generator.GetParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr"))).Count) 2850Assert.Equal(1, Generator.GetParameters(Generator.ValueReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count) 2852Assert.Equal(0, Generator.GetParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr"))).Count) 2853Assert.Equal(1, Generator.GetParameters(Generator.VoidReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count) 2855Assert.Equal(0, Generator.GetParameters(Generator.DelegateDeclaration("d")).Count) 2856Assert.Equal(1, Generator.GetParameters(Generator.DelegateDeclaration("d", parameters:={Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count) 2858Assert.Equal(0, Generator.GetParameters(Generator.ClassDeclaration("c")).Count) 2859Assert.Equal(0, Generator.GetParameters(Generator.IdentifierName("x")).Count) 2864Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.MethodDeclaration("m"), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count) 2865Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ConstructorDeclaration(), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count) 2866Assert.Equal(3, Generator.GetParameters(Generator.AddParameters(Generator.IndexerDeclaration({Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))}, Generator.IdentifierName("t")), {Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2")), Generator.ParameterDeclaration("p3", Generator.IdentifierName("t3"))})).Count) 2868Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr")), {Generator.LambdaParameter("p")})).Count) 2869Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr")), {Generator.LambdaParameter("p")})).Count) 2871Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.DelegateDeclaration("d"), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count) 2873Assert.Equal(0, Generator.GetParameters(Generator.AddParameters(Generator.ClassDeclaration("c"), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count) 2874Assert.Equal(0, Generator.GetParameters(Generator.AddParameters(Generator.IdentifierName("x"), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count) 2875Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count) 2887Assert.Equal(1, Generator.GetStatements(Generator.ValueReturningLambdaExpression("p", {Generator.IdentifierName("x")})).Count) 2965Assert.Equal(0, Generator.GetStatements(Generator.MethodDeclaration("m")).Count) 2966Assert.Equal(2, Generator.GetStatements(Generator.MethodDeclaration("m", statements:=stmts)).Count) 2968Assert.Equal(0, Generator.GetStatements(Generator.ConstructorDeclaration()).Count) 2969Assert.Equal(2, Generator.GetStatements(Generator.ConstructorDeclaration(statements:=stmts)).Count) 2971Assert.Equal(0, Generator.GetStatements(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("e"))).Count) 2972Assert.Equal(0, Generator.GetStatements(Generator.VoidReturningLambdaExpression({})).Count) 2973Assert.Equal(2, Generator.GetStatements(Generator.VoidReturningLambdaExpression(stmts)).Count) 2975Assert.Equal(0, Generator.GetStatements(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("e"))).Count) 2976Assert.Equal(0, Generator.GetStatements(Generator.ValueReturningLambdaExpression({})).Count) 2977Assert.Equal(2, Generator.GetStatements(Generator.ValueReturningLambdaExpression(stmts)).Count) 2979Assert.Equal(0, Generator.GetStatements(Generator.IdentifierName("x")).Count) 2986Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.MethodDeclaration("m"), stmts)).Count) 2987Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ConstructorDeclaration(), stmts)).Count) 2989Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.VoidReturningLambdaExpression({}), stmts)).Count) 2990Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ValueReturningLambdaExpression({}), stmts)).Count) 2992Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("e")), stmts)).Count) 2993Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("e")), stmts)).Count) 2995Assert.Equal(0, Generator.GetStatements(Generator.WithStatements(Generator.IdentifierName("x"), stmts)).Count) 3056Assert.Equal(2, _g.GetAccessors(prop).Count) 3082Assert.Equal(0, _g.GetStatements(getAccessor).Count) 3083Assert.Equal(0, _g.GetStatements(setAccessor).Count) 3105Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count) 3106Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), getAccessorStatements:=stmts)).Count) 3108Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.IndexerDeclaration({p}, Generator.IdentifierName("t"))).Count) 3109Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.IndexerDeclaration({p}, Generator.IdentifierName("t"), getAccessorStatements:=stmts)).Count) 3111Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.IdentifierName("x")).Count) 3114Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count) 3115Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), setAccessorStatements:=stmts)).Count) 3117Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.IndexerDeclaration({p}, Generator.IdentifierName("t"))).Count) 3118Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.IndexerDeclaration({p}, Generator.IdentifierName("t"), setAccessorStatements:=stmts)).Count) 3120Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.IdentifierName("x")).Count) 3130Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count) 3131Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.IndexerDeclaration({p}, Generator.IdentifierName("t")), stmts)).Count) 3132Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count) 3135Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count) 3136Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.IndexerDeclaration({p}, Generator.IdentifierName("t")), stmts)).Count) 3137Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count) 3194Assert.Equal(0, Generator.GetMembers(Generator.RemoveNodes(declaration, Generator.GetMembers(declaration))).Count) 3207Assert.Equal(2, baseListBI.Count) 3219Assert.Equal(2, baseListXY.Count) 3242Assert.Equal(3, baseList.Count) 3533Assert.Equal(1, Generator.GetAttributes(xAttributed).Count) 3537Assert.Equal(3, membersC.Count) 3731Assert.Equal(3, attrs.Count) 3863Assert.Equal(3, imps.Count)
Microsoft.CodeAnalysis.Workspaces (70)
CodeFixesAndRefactorings\FixAllLogger.cs (2)
83m[DocumentCount] = fixAllState.Project.DocumentIds.Count; 87m[DocumentCount] = fixAllState.Solution.Projects.Sum(p => p.DocumentIds.Count);
Diagnostics\DiagnosticData.cs (2)
256if (diagnostic.AdditionalLocations.Count == 0) 261using var _ = ArrayBuilder<DiagnosticDataLocation>.GetInstance(diagnostic.AdditionalLocations.Count, out var builder);
Differencing\MapBasedLongestCommonSubsequence.cs (2)
17foreach (var edit in GetEdits(oldNodes, oldNodes.Count, newNodes, newNodes.Count))
Differencing\Match.LongestCommonSubsequence.cs (4)
31foreach (var pair in GetMatchingPairs(oldNodes, oldNodes.Count, newNodes, newNodes.Count)) 41foreach (var edit in GetEdits(oldNodes, oldNodes.Count, newNodes, newNodes.Count))
Editing\SyntaxGenerator.cs (10)
1030attributeArguments: args.Count > 0 ? args : null); 1105=> this.InsertAttributes(declaration, this.GetAttributes(declaration).Count, attributes); 1133=> this.InsertReturnAttributes(declaration, this.GetReturnAttributes(declaration).Count, attributes); 1155=> this.InsertAttributeArguments(attributeDeclaration, this.GetAttributeArguments(attributeDeclaration).Count, attributeArguments); 1177=> this.InsertNamespaceImports(declaration, this.GetNamespaceImports(declaration).Count, imports); 1205=> this.InsertMembers(declaration, this.GetMembers(declaration).Count, members); 1274=> this.InsertParameters(declaration, this.GetParameters(declaration).Count, parameters); 1290=> this.InsertSwitchSections(switchStatement, this.GetSwitchSections(switchStatement).Count, switchSections); 1332=> this.InsertAccessors(declaration, this.GetAccessors(declaration).Count, accessors); 1517for (int i = 0, count = list.Count; i < count; i++)
FindSymbols\FindReferences\DependentTypeFinder.cs (1)
464var order = new Dictionary<ProjectId, int>(capacity: solution.ProjectIds.Count);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (1)
93if (scope != null && scope.Count == 1)
Serialization\AbstractOptionsSerializationService.cs (1)
198writer.WriteInt32(options.Features.Count);
Serialization\SerializerService_Reference.cs (3)
94if (portable is ISupportTemporaryStorage { StorageHandles: { Count: > 0 } handles } && 356Contract.ThrowIfTrue(handles.Count == 0); 361writer.WriteInt32(handles.Count);
Shared\Extensions\SourceTextExtensions.cs (2)
64if (ranges.Count == 0) 70if (ranges.Count == 1)
src\Compilers\Core\Portable\InternalUtilities\EnumerableExtensions.cs (7)
281return readOnlyCollection.Count == 0; 309return source.Count == 0; 389var builder = new TResult[source.Count]; 405var builder = new TResult[source.Count]; 446var builder = ArrayBuilder<TResult>.GetInstance(source.Count); 459var builder = ArrayBuilder<TResult>.GetInstance(source.Count); 598for (int i = 0, length = list.Count; i < length; i++)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (2)
18if (changesInNextVersion.Count == 0) 27var newChange = changesInNextVersion.Count == 1
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamespaceOrTypeSymbolExtensions.cs (4)
44for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++) 71return names1.Count - names2.Count;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\AbstractSyntaxFormatting.cs (1)
45if (spansToFormat.Count == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (3)
49Contract.ThrowIfFalse(spans.Count > 0); 51if (spans.Count == 1) 61for (var i = 1; i < spans.Count; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\IReadOnlyListExtensions.cs (2)
23=> list[list.Count - 1]; 27for (var index = startIndex; index < list.Count; index++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PublicContract.cs (1)
112var length = list.Count;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (1)
92var result = new FixedSizeArrayBuilder<TResult>(tasks.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (4)
38if (insertionIndex >= existingParameters.Count) 44syntaxFacts, existingParameters[existingParameters.Count - 1], includeLeadingNewLine: true); 154if (parameters.Count <= 1) 160for (int i = 1, n = parameters.Count; i < n; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.cs (2)
101if (statementIndex + 1 < state.OutermostBlockStatements.Count && 148if (statementIndex + 1 < state.OutermostBlockStatements.Count)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (2)
82if (textChanges.Count > 1 || 83textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Workspace\ProjectSystem\ProjectSystemProject.cs (1)
1385if (w.CurrentSolution.ProjectIds.Count == 1)
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (2)
148if (oldSolution.ProjectIds.Count == 0) 171return oldSolution.ProjectIds.Count == 0
Workspace\Solution\ChecksumCollection.cs (1)
97Contract.ThrowIfFalse(values.Count == checksums.Children.Length);
Workspace\Solution\ProjectDependencyGraph.cs (1)
144else if (projectReferences.Count == 0)
Workspace\Solution\ProjectDependencyGraph_AddProjectReference.cs (1)
19if (projectReferences.Count == 0)
Workspace\Solution\SolutionState.cs (5)
154Contract.ThrowIfFalse(ProjectStates.Count == ProjectIds.Count); 375using var _1 = ArrayBuilder<ProjectId>.GetInstance(ProjectIds.Count + projectStates.Count, out var newProjectIdsBuilder); 729if (projectReferences.Count == 0) 838if (metadataReferences.Count == 0) 1205if (analyzerReferences.Count == 0)
Workspace\Solution\StateChecksums.cs (1)
590var checksums = new FixedSizeArrayBuilder<Checksum>(references.Count);
Workspace\Workspace.cs (1)
746using var _ = ArrayBuilder<ProjectInfo>.GetInstance(projects.Count, out var builder);
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
MSBuild\MSBuildProjectLoader.Worker.cs (1)
438var results = new FixedSizeArrayBuilder<DocumentInfo>(documentFileInfos.Count);
MSBuild\MSBuildWorkspace.cs (1)
464var relativePath = (info.Folders != null && info.Folders.Count > 0)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (8)
src\Compilers\Core\Portable\InternalUtilities\EnumerableExtensions.cs (7)
281return readOnlyCollection.Count == 0; 309return source.Count == 0; 389var builder = new TResult[source.Count]; 405var builder = new TResult[source.Count]; 446var builder = ArrayBuilder<TResult>.GetInstance(source.Count); 459var builder = ArrayBuilder<TResult>.GetInstance(source.Count); 598for (int i = 0, length = list.Count; i < length; i++)
src\Compilers\Core\Portable\InternalUtilities\IReadOnlyListExtensions.cs (1)
14for (int i = 0; i < list.Count; i++)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (14)
NetCoreTests.cs (8)
123Assert.Equal(2, workspace.CurrentSolution.ProjectIds.Count); 152Assert.Equal(2, workspace.CurrentSolution.ProjectIds.Count); 163Assert.Equal(3, workspace.CurrentSolution.ProjectIds.Count); 195Assert.Equal(3, workspace.CurrentSolution.ProjectIds.Count); 237Assert.Equal(3, workspace.CurrentSolution.ProjectIds.Count); 285Assert.Equal(4, workspace.CurrentSolution.ProjectIds.Count); 442Assert.Equal(2, workspace.CurrentSolution.ProjectIds.Count); 500Assert.Equal(2, workspace.CurrentSolution.ProjectIds.Count);
VisualStudioMSBuildWorkspaceTests.cs (6)
2327Assert.Equal(1, proj.AnalyzerReferences.Count); 2726Assert.Equal(2, solution.ProjectIds.Count); 2752Assert.Equal(3, solution.ProjectIds.Count); 3026Assert.Equal(2, proj.DocumentIds.Count); 3044Assert.Equal(2, project.DocumentIds.Count); 3290Assert.Equal(0, workspace.CurrentSolution.ProjectIds.Count);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Workspaces\TestWorkspace_XmlCreation.cs (1)
122if (parseOptions.Features == null || parseOptions.Features.Count == 0)
Microsoft.CodeAnalysis.Workspaces.UnitTests (32)
CommandLineProject\CommandLineProjectTests.cs (7)
28Assert.Equal(0, docInfo.Folders.Count); 59Assert.Equal(0, docInfo.Folders.Count); 70Assert.Equal(1, docInfo.Folders.Count); 82Assert.Equal(0, docInfo.Folders.Count); 93Assert.Equal(1, docInfo.Folders.Count); 105Assert.Equal(0, docInfo.Folders.Count); 116Assert.Equal(0, docInfo.Folders.Count);
CommandLineProject\CommandLineProjectWorkspaceTests.cs (3)
39Assert.Equal(0, gooDoc.Folders.Count); 67Assert.Equal(0, gooDoc.Folders.Count); 71Assert.Equal(1, barDoc.Folders.Count);
SolutionTests\SolutionTests.cs (14)
2992Assert.Equal(1, actualAnalyzerReferences.Count); 3018Assert.Equal(2, actualAnalyzerReferences.Count); 3024Assert.Equal(1, actualAnalyzerReferences.Count); 3030Assert.Equal(2, actualAnalyzerReferences.Count); 4969Assert.Equal(2, solution.ProjectIds.Count); 4993Assert.Equal(2, solution.ProjectIds.Count); 5021Assert.Equal(2, solution.ProjectIds.Count); 5052Assert.Equal(3, solution.ProjectIds.Count); 5083Assert.Equal(3, solution.ProjectIds.Count); 5115Assert.Equal(3, solution.ProjectIds.Count); 5167Assert.Equal(3, solution.ProjectIds.Count); 5183Assert.Equal(1, solution.ProjectIds.Count); 5212Assert.Equal(3, solution.ProjectIds.Count); 5227Assert.Equal(1, solution.ProjectIds.Count);
WorkspaceTests\AdhocWorkspaceTests.cs (7)
97Assert.Equal(sinfo.Projects.Count, solution.ProjectIds.Count); 129Assert.Equal(2, solution.ProjectIds.Count); 448Assert.Equal(0, originalDoc.Folders.Count); 468Assert.Equal(2, appliedDoc.Folders.Count); 547Assert.Equal(0, originalDoc.Folders.Count); 564Assert.Equal(2, appliedDoc.Folders.Count);
WorkspaceTests\WorkspaceTests.cs (1)
56Assert.Equal(0, originalDoc.Folders.Count);
Microsoft.Data.Analysis (17)
DataFrame.BinaryOperations.cs (14)
18if (values.Count != Columns.Count) 57if (values.Count != Columns.Count) 96if (values.Count != Columns.Count) 135if (values.Count != Columns.Count) 174if (values.Count != Columns.Count) 212if (values.Count != Columns.Count) 249if (values.Count != Columns.Count) 286if (values.Count != Columns.Count) 360if (values.Count != Columns.Count) 393if (values.Count != Columns.Count) 426if (values.Count != Columns.Count) 459if (values.Count != Columns.Count) 492if (values.Count != Columns.Count) 525if (values.Count != Columns.Count)
DataFrame.Join.Extrensions.cs (3)
19while (i < sortedList1.Count && j < sortedList2.Count) 23while (j < sortedList2.Count)
Microsoft.Data.Analysis.Tests (6)
ArrayComparer.cs (5)
67Assert.Equal(expectedArray.Fields.Count, array.Fields.Count); 69for (int i = 0; i < array.Fields.Count; i++) 161if (s2 == null || s1 == null || s1.HasMetadata != s2.HasMetadata || s1.FieldsList.Count != s2.FieldsList.Count)
DataFrameTests.cs (1)
952Assert.Equal(columns.Count, df.Columns.Count);
Microsoft.DotNet.Arcade.Sdk (1)
src\GenerateResxSource.cs (1)
523public bool HasArguments => _arguments.Count > 0;
Microsoft.DotNet.NuGetRepack.Tasks (2)
src\NuGetVersionUpdater.cs (2)
377if (exceptions.Count == 1) 382if (exceptions.Count > 1)
Microsoft.Extensions.AI (6)
ChatCompletion\FunctionInvokingChatClient.cs (1)
495int functionCount = functionCallContents.Count;
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.AI.Abstractions (5)
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.AI.AzureAIInference (7)
AzureAIInferenceChatClient.cs (2)
107if (response.ToolCalls is { Count: > 0 } toolCalls) 382if (parameters is { Count: > 0 })
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.AI.Integration.Tests (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.AI.Ollama (5)
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.AI.OpenAI (11)
OpenAIModelMapper.ChatCompletion.cs (3)
123if (openAICompletion.ContentTokenLogProbabilities is { Count: > 0 } contentTokenLogProbs) 133if (openAICompletion.RefusalTokenLogProbabilities is { Count: > 0 } refusalTokenLogProbs) 404if (parameters is { Count: > 0 })
OpenAIModelMappers.StreamingChatCompletion.cs (3)
100if (chatCompletionUpdate.ContentTokenLogProbabilities is { Count: > 0 } contentTokenLogProbs) 105if (chatCompletionUpdate.RefusalTokenLogProbabilities is { Count: > 0 } refusalTokenLogProbs) 134if (chatCompletionUpdate.ToolCallUpdates is { Count: > 0 } toolCallUpdates)
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.AmbientMetadata.Application (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.AsyncState (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Caching.Hybrid (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Compliance.Abstractions (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Compliance.Redaction (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Compliance.Testing (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Compliance.Testing.Tests (2)
FakeRedactorTests.cs (1)
90Assert.Equal(fakeRedactorProvider.Collector.AllRedactorRequests.Count, iterations.Length);
RedactionFakesAcceptanceTests.cs (1)
212Assert.Equal(2, collector.AllRedactedData.Count);
Microsoft.Extensions.DependencyInjection.AutoActivation (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.DependencyModel (4)
DependencyContextWriter.cs (4)
135int count = libraries.Count; 198if (dependencies.Count == 0) 213int count = resourceAssemblies.Count; 322if (group.RuntimeFiles.Count != 0)
Microsoft.Extensions.Diagnostics.ExceptionSummarization (2)
ExceptionSummarizer.cs (1)
90if (descriptionIndex >= exceptionSummaryProvider.Descriptions.Count || descriptionIndex < 0)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Diagnostics.HealthChecks (1)
DefaultHealthCheckService.cs (1)
259if (entry.Data.Count > 0 && logger.IsEnabled(LogLevel.Debug))
Microsoft.Extensions.Diagnostics.HealthChecks.Common (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Diagnostics.Probes (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (1)
Windows\WindowsSnapshotProviderTests.cs (1)
68Assert.Equal(2, logRecords.Count);
Microsoft.Extensions.Diagnostics.Testing (3)
Metrics\CollectedMeasurement.cs (2)
100public bool MatchesTags(params KeyValuePair<string, object?>[] tags) => ContainsTags(tags) && (Tags.Count == tags.Length); 107public bool MatchesTags(params string[] tags) => ContainsTags(Throw.IfNull(tags)) && (Tags.Count == tags.Length);
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Diagnostics.Testing.Tests (14)
Logging\FakeLoggerProviderTests.cs (1)
48Assert.Equal(2, records.Count);
Logging\FakeLoggerTests.cs (2)
33Assert.Equal(2, records.Count); 282Assert.Equal(2, logger.LatestRecord.Scopes.Count);
Metrics\MeasurementExtensionsTests.cs (4)
31Assert.Equal(2, filtered[1].Tags.Count); 56Assert.Equal(2, filtered[1].Tags.Count); 81Assert.Equal(2, filtered[1].Tags.Count); 109Assert.Equal(2, filtered[1].Tags.Count);
Metrics\MetricCollectorTests.cs (7)
73Assert.Equal(2, collector.GetMeasurementSnapshot().Count); 118Assert.Equal(2, collector.GetMeasurementSnapshot().Count); 165Assert.Equal(2, collector.GetMeasurementSnapshot().Count); 226Assert.Equal(2, collector.GetMeasurementSnapshot().Count); 399Assert.Equal(3, snap.Count); 400Assert.Equal(3, collector.GetMeasurementSnapshot().Count); 415Assert.Equal(3, snap.Count);
Microsoft.Extensions.FileProviders.Embedded (2)
Manifest\ManifestDirectory.cs (2)
89var list = new List<ManifestEntry>(Children.Count); 90for (var i = 0; i < Children.Count; i++)
Microsoft.Extensions.Hosting.Testing (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Http (1)
HttpMessageHandlerBuilder.cs (1)
92for (int i = additionalHandlersList.Count - 1; i >= 0; i--)
Microsoft.Extensions.Http.Diagnostics (9)
Logging\Internal\HttpHeadersRedactor.cs (5)
99if (input.Count == 0) 106if (input.Count == 1) 118for (int i = 1; i < input.Count; i++) 134for (int i = 0; i < input.Count; i++) 142if (i < input.Count - 1)
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
Microsoft.Extensions.Http.Diagnostics.Tests (4)
Logging\HttpClientLoggerTest.cs (4)
337Assert.Equal(2, logRecords.Count); 740Assert.Equal(2, logRecords.Count); 778Assert.Equal(2, logRecords.Count); 823Assert.Equal(2, logRecords.Count);
Microsoft.Extensions.Http.Resilience (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Logging.Console (1)
JsonConsoleFormatter.cs (1)
35bufferedRecord.Attributes.Count > 0, null, bufferedRecord.Attributes, bufferedRecord.Timestamp);
Microsoft.Extensions.Logging.EventSource (2)
EventSourceLogger.cs (2)
244var arguments = new KeyValuePair<string, string?>[keyValuePairs.Count]; 245for (int i = 0; i < keyValuePairs.Count; i++)
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Roslyn3.11.cs (1)
34if (logClasses.Count > 0)
Microsoft.Extensions.ObjectPool.DependencyInjection (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Options.Contextual (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Options.SourceGeneration (1)
Generator.cs (1)
51if (validatorTypes.Count > 0)
Microsoft.Extensions.Primitives (3)
CompositeChangeToken.cs (3)
39for (int i = 0; i < ChangeTokens.Count; i++) 71for (int i = 0; i < ChangeTokens.Count; i++) 105for (int i = 0; i < ChangeTokens.Count; i++)
Microsoft.Extensions.Resilience (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.ServiceDiscovery (5)
Configuration\ConfigurationServiceEndpointProvider.cs (1)
43_includeAllSchemes = serviceDiscoveryOptions.Value.AllowAllSchemes && query.IncludedSchemes.Count == 0;
LoadBalancing\RoundRobinServiceEndpointSelector.cs (2)
23if (_endpoints is not { Count: > 0 } collection) 28return collection[(int)(Interlocked.Increment(ref _next) % collection.Count)];
ServiceDiscoveryOptions.cs (1)
35if (schemes.Count > 0)
ServiceEndpointWatcher.Log.cs (1)
25ResolutionSucceededCore(logger, endpointSource.Endpoints.Count, serviceName, string.Join(", ", endpointSource.Endpoints.Select(GetEndpointString)));
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (3)
DnsServiceEndpointResolverTests.cs (3)
25Assert.True(initialResult.Endpoints.Count > 0); 29Assert.True(initialResult.Endpoints.Count > 0); 33Assert.True(initialResult.Endpoints.Count > 0);
Microsoft.Extensions.ServiceDiscovery.Yarp (1)
ServiceDiscoveryDestinationResolver.cs (1)
27var tasks = new List<Task<(List<(string Name, DestinationConfig Config)>, IChangeToken ChangeToken)>>(destinations.Count);
Microsoft.Extensions.Telemetry (2)
Logging\ExtendedLogger.LegacyTagJoiner.cs (1)
46_incomingTagCount = _incomingTags.Count;
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Telemetry.Abstractions (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Extensions.Telemetry.Abstractions.Tests (6)
Latency\LatencyRegistryExtensionsTests.cs (3)
80Assert.True(lcro.CheckpointNames.Count == 1); 81Assert.True(lcro.MeasureNames.Count == 2); 82Assert.True(lcro.TagNames.Count == 3);
Logging\LoggerMessageStateTests.cs (3)
141Assert.Equal(1, list.Count); 151Assert.Equal(1, list.Count); 157Assert.Equal(1, list.Count);
Microsoft.Extensions.Telemetry.PerformanceTests (1)
BenchLogger.cs (1)
41int count = l.Count;
Microsoft.Extensions.TimeProvider.Testing (1)
src\Shared\Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Microsoft.Gen.ComplianceReports (1)
ComplianceReportsGenerator.cs (1)
73if (classifiedTypes.Count == 0)
Microsoft.Gen.ComplianceReports.Unit.Tests (4)
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
Microsoft.Gen.ContextualOptions.Unit.Tests (4)
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
Microsoft.Gen.Logging (1)
LoggingGenerator.cs (1)
44if (logTypes.Count > 0)
Microsoft.Gen.Logging.Generated.Tests (9)
LoggerMessageAttributeTests.cs (1)
160Assert.Equal(expectedState.Length, collector.LatestRecord.StructuredState!.Count);
LogMethodTests.cs (3)
91Assert.Equal(3, collector.LatestRecord.StructuredState!.Count); 99Assert.Equal(3, collector.LatestRecord.StructuredState!.Count); 942Assert.Equal(expected, rol.Count);
LogPropertiesTests.cs (3)
63Assert.Equal(2, state.Count); 80Assert.Equal(2, state.Count); 120Assert.Equal(21, state.Count);
TagProviderTests.cs (2)
167Assert.Equal(2, state.Count); 193Assert.Equal(2, state.Count);
Microsoft.Gen.Logging.Unit.Tests (6)
ParserTests.cs (2)
748else if (d.Count > 0) 750Assert.Fail($"Expected no diagnostics, got {d.Count} diagnostics");
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
Microsoft.Gen.MetadataExtractor (8)
MetadataReportsGenerator.cs (2)
124if (meteringClasses.Count == 0) 151if (classifiedTypes.Count == 0)
src\Generators\Microsoft.Gen.ComplianceReports\ComplianceReportsGenerator.cs (1)
73if (classifiedTypes.Count == 0)
src\Generators\Microsoft.Gen.Metrics\MetricsGenerator.cs (1)
36if (metricClasses.Count > 0)
src\Generators\Microsoft.Gen.MetricsReports\MetricDefinitionEmitter.cs (3)
23if (metricClasses == null || metricClasses.Count == 0) 30for (int i = 0; i < metricClasses.Count; i++) 36if (i < metricClasses.Count - 1)
src\Generators\Microsoft.Gen.MetricsReports\MetricsReportsGenerator.cs (1)
70if (meteringClasses.Count == 0)
Microsoft.Gen.MetadataExtractor.Unit.Tests (4)
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
Microsoft.Gen.Metrics (1)
MetricsGenerator.cs (1)
36if (metricClasses.Count > 0)
Microsoft.Gen.Metrics.Generated.Tests (2)
MetricTests.cs (2)
171Assert.Equal(2, measurements.Count); 195Assert.Equal(2, measurements.Count);
Microsoft.Gen.Metrics.Unit.Tests (4)
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
Microsoft.Gen.MetricsReports (4)
MetricDefinitionEmitter.cs (3)
23if (metricClasses == null || metricClasses.Count == 0) 30for (int i = 0; i < metricClasses.Count; i++) 36if (i < metricClasses.Count - 1)
MetricsReportsGenerator.cs (1)
70if (meteringClasses.Count == 0)
Microsoft.Gen.MetricsReports.Unit.Tests (4)
src\Shared\EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
Microsoft.Interop.LibraryImportGenerator (1)
Analyzers\AddDisableRuntimeMarshallingAttributeFixer.cs (1)
75&& document.Folders.Count == 1
Microsoft.Maui (3)
Layouts\GridLayoutManager.cs (2)
157 int count = rowDefinitions.Count; 178 int count = columnDefinitions.Count;
VisualDiagnostics\VisualDiagnosticsOverlay.cs (1)
109 if (WindowElements.Count == 0)
Microsoft.Maui.Controls (98)
Application\Application.cs (4)
95 if (Windows.Count == 0) 121 if (Windows.Count == 1) 537 if (Windows.Count > 1) 542 if (Windows.Count > 0)
ContentPresenter.cs (1)
43 for (var i = 0; i < LogicalChildrenInternal.Count; i++)
Element\Element.cs (3)
706 for (var i = 0; i < children.Count; i++) 812 for (var i = 0; i < children.Count; i++) 1086 int ICollection<Element>.Count => _inner.Count;
LegacyLayouts\Layout.cs (3)
436 var oldBounds = new Rect[LogicalChildrenInternal.Count]; 465 for (var i = 0; i < LogicalChildrenInternal.Count; i++) 548 int count = children.Count;
LegacyLayouts\StackLayout.cs (5)
70 for (var i = 0; i < LogicalChildrenInternal.Count; i++) 157 for (var i = 0; i < LogicalChildrenInternal.Count; i++) 193 for (var i = 0; i < LogicalChildrenInternal.Count; i++) 424 for (var i = 0; i < LogicalChildrenInternal.Count; i++) 452 for (var i = 0; i < LogicalChildrenInternal.Count; i++)
NavigationPage\NavigationPage.cs (9)
467 CurrentPage = (Page)newStack[newStack.Count - 1]; 480 for (int i = 0; i < newStack.Count; i++) 500 while (InternalChildren.Count > newStack.Count) 694 var visiblePage = Navigation.NavigationStack[NavigationStack.Count - 1]; 783 var currentPage = NavigationStack[NavigationStack.Count - 1]; 784 var newCurrentPage = NavigationStack[NavigationStack.Count - 2]; 813 if (NavigationStack.Count == 1) 823 var lastIndex = NavigationStack.Count - 1; 828 lastIndex = NavigationStack.Count - 1;
NavigationPage\NavigationPageToolbar.cs (5)
147 if (navPage.Navigation.NavigationStack.Count == 0) 150 if (navPage.Navigation.NavigationStack.Count > 1) 212 if (stack.Count == 0) 218 if (stack.Count > 1) 219 previousPage = stack[stack.Count - 1];
Platform\ModalNavigationManager\ModalNavigationManager.cs (1)
290 if (ModalStack.Count == 0)
ReadOnlyCastingList.cs (1)
60 get { return _readonlyList.Count; }
ReadOnlyListAdapter.cs (1)
33 get { return _collection.Count; }
Region.cs (3)
75 for (int i = 0; i < Regions.Count; i++) 103 Rect[] rectangles = new Rect[Regions.Count]; 104 for (int i = 0; i < Regions.Count; i++)
Routing.cs (2)
46 var navigationStackCount = section.Navigation.NavigationStack.Count; 51 var navigationModalStackCount = section.Navigation.ModalStack.Count;
Shell\BaseShellItem.cs (4)
174 if (Navigation.ModalStack.Count > 0) 176 Navigation.ModalStack[Navigation.ModalStack.Count - 1] 181 else if (Navigation.NavigationStack.Count > 1) 183 Navigation.NavigationStack[Navigation.NavigationStack.Count - 1]
Shell\RouteRequestBuilder.cs (1)
204 var nextMatch = matchedSegments.Count;
Shell\Shell.cs (6)
956 if (Application.Current is null || Application.Current.Windows.Count == 0) 959 if (Application.Current.Windows.Count == 1) 1536 if (currentContent != null && currentContent.Stack.Count > 1) 1942 currentPage = navStack[navStack.Count - 1] ?? 2107 if (ModalStack.Count == 0 && !_shell.CurrentItem.CurrentItem.IsPoppingModalStack) 2129 if (ModalStack.Count == 0)
Shell\ShellElementCollection.cs (1)
215 return (sgi.ShellElementCollection.VisibleItemsReadOnly.Count > 0) ||
Shell\ShellNavigationManager.cs (14)
157 if (!modalStackPreBuilt && currentShellSection?.Navigation.ModalStack.Count > 0) 167 for (int i = currentShellSection.Stack.Count - 1; i >= 1; i--) 185 nextActiveSection?.Navigation?.NavigationStack?.Count > 1) 491 (modalStack?.Count > 0 ? modalStack[modalStack.Count - 1] : null) ?? 492 (navStack?.Count > 0 ? navStack[navStack.Count - 1] : null); 521 bool stackAtRoot = sectionStack == null || sectionStack.Count <= 1; 545 for (int i = 1; i < sectionStack.Count; i++) 552 if (modalStack != null && modalStack.Count > 0) 554 for (int i = 0; i < modalStack.Count; i++) 560 for (int j = 1; j < topPage.Navigation.NavigationStack.Count; j++) 587 for (int i = 0; i < modalStack.Count; i++) 590 for (int j = 1; j < modalStack[i].Navigation.NavigationStack.Count; j++)
Shell\ShellSection.cs (18)
56 if (Navigation.ModalStack.Count > 0) 58 if (Navigation.ModalStack[Navigation.ModalStack.Count - 1] is NavigationPage np) 59 return np.Navigation.NavigationStack[np.Navigation.NavigationStack.Count - 1]; 61 return Navigation.ModalStack[Navigation.ModalStack.Count - 1]; 328 if (Navigation.ModalStack.Count > 0) 349 if (Navigation.ModalStack.Count == 0) 420 while (navStack.Count > popCount && Navigation.ModalStack.Count > 0) 427 else if (Navigation.ModalStack.Count > 0) 429 await Navigation.ModalStack[Navigation.ModalStack.Count - 1].Navigation.PopAsync(isAnimated); 548 for (int i = Navigation.ModalStack.Count - 1; i >= 0; i--) 640 if (stack.Count > 1) 642 DisplayedPage = stack[stack.Count - 1]; 878 int modalStackCount = Navigation.ModalStack.Count; 881 var pageToPop = Navigation.ModalStack[Navigation.ModalStack.Count - 1]; 887 if (page == null && Navigation.ModalStack.Count == 1) 891 else if (Navigation.ModalStack.Count > 1 && Navigation.ModalStack[Navigation.ModalStack.Count - 2] == page) 1154 var page = ModalStack[ModalStack.Count - 1];
Shell\ShellUriHandler.cs (1)
451 if (routeRequestBuilder.FullSegments.Count <= i || currentSeg != routeRequestBuilder.FullSegments[i])
ShellToolbar.cs (6)
73 if (stack.Count == 0) 82 if (stack.Count > 1) 83 previousPage = stack[stack.Count - 1]; 93 _drawerToggleVisible = stack.Count <= 1; 94 BackButtonVisible = backButtonVisible && stack.Count > 1; 181 else if (_shell.Navigation?.NavigationStack?.Count <= 1)
TemplatedView\TemplatedView.cs (1)
33 for (var i = 0; i < LogicalChildrenInternal.Count; i++)
TemplateUtilities.cs (1)
93 for (var i = 0; i < children.Count; i++)
ViewExtensions.cs (2)
511 if (modalStack.Count > 0) 513 var currentPage = modalStack[modalStack.Count - 1];
VisualElement\VisualElement.cs (1)
1346 for (var i = 0; i < LogicalChildrenInternal.Count; i++)
Window\Window.cs (4)
427 if (Navigation.ModalStack.Count == 0) 433 if (Navigation.ModalStack.Count == 0) 678 if (Navigation.ModalStack.Count > 0) 680 return Navigation.ModalStack[Navigation.ModalStack.Count - 1].SendBackButtonPressed();
Microsoft.Maui.Controls.Build.Tasks (1)
CompiledMarkupExtensions\ArrayExtension.cs (1)
22 var n = items.Count;
Microsoft.Maui.Graphics (5)
Text\AttributedTextExtensions.cs (4)
91 if (text.Runs == null || text.Runs.Count == 0) 95 if (!(startIndexForSearch < text.Runs.Count)) 149 } while (index < text.Runs.Count); 164 if (text.Runs?.Count > 0)
Text\XmlAttributedTextWriter.cs (1)
43 if (attributedText.Runs != null && attributedText.Runs.Count > 0)
Microsoft.ML.AutoML (8)
ColumnInference\PurposeInference.cs (4)
146if (imagePathCount < data.Count - 1) 148Double avgLength = 1.0 * sumLength / data.Count; 149Double cardinalityRatio = 1.0 * seen.Count / data.Count; 150Double avgSpaces = 1.0 * sumSpaces / data.Count;
Experiment\MetricsAgents\RankingMetricsAgent.cs (2)
42return metrics.NormalizedDiscountedCumulativeGains[Math.Min(metrics.NormalizedDiscountedCumulativeGains.Count, (int)_dcgTruncationLevel) - 1]; 44return metrics.DiscountedCumulativeGains[Math.Min(metrics.DiscountedCumulativeGains.Count, (int)_dcgTruncationLevel) - 1];
Sweepers\SmacSweeper.cs (1)
331for (var treeId = 0; treeId < forest.TrainedTreeEnsemble.Trees.Count; treeId++)
Tuner\SmacTuner.cs (1)
323for (var treeId = 0; treeId < forest.TrainedTreeEnsemble.Trees.Count; treeId++)
Microsoft.ML.AutoML.Tests (2)
AutoFitTests.cs (2)
455Assert.Equal(10, bestRun.ValidationMetrics.DiscountedCumulativeGains.Count); 456Assert.Equal(10, bestRun.ValidationMetrics.NormalizedDiscountedCumulativeGains.Count);
Microsoft.ML.Core (14)
Data\AnnotationUtils.cs (1)
304if (list?.Count != 1 || !schema.Schema[list[0].Index].HasSlotNames(vectorSize))
Data\ProgressReporter.cs (7)
133Contracts.Assert(entry.Header.MetricNames.Count == 0 && entry.Header.UnitNames.Count == 0); 233Contracts.Assert(entry.Header.MetricNames.Count == 0 && entry.Header.UnitNames.Count == 0); 559Progress = new Double?[header.UnitNames.Count]; 560ProgressLim = new Double?[header.UnitNames.Count]; 561Metrics = new Double?[header.MetricNames.Count];
Data\RoleMappedSchema.cs (3)
172if (cols.Count == 1) 244=> _map.TryGetValue(role.Value, out var cols) && cols.Count == 1; 250=> _map.TryGetValue(role.Value, out var cols) && cols.Count > 1;
Environment\ConsoleEnvironment.cs (2)
273for (int i = 0; i < ev.ProgressEntry.Header.UnitNames.Count; i++) 286for (int i = 0; i < ev.ProgressEntry.Header.MetricNames.Count; i++)
Utilities\Utils.cs (1)
87return x == null ? 0 : x.Count;
Microsoft.ML.Data (13)
DataView\RowToRowMapperTransform.cs (2)
176Contracts.Assert(0 <= col && col < _bindings.AddedColumnIndices.Count); 177return 0 <= col && col < _bindings.AddedColumnIndices.Count && active[_bindings.AddedColumnIndices[col]];
Evaluators\BinaryClassifierEvaluator.cs (3)
145host.CheckParam(prob.Count == 1, nameof(schema), "Cannot have multiple probability columns"); 162Host.Assert(prob == null || prob.Count == 1); 633Host.Assert(prob == null || prob.Count == 1);
Evaluators\EvaluatorUtils.cs (2)
1594int numLabels = confusionMatrix?.Counts == null ? 0 : confusionMatrix.Counts.Count; 1610rowDigitLen = Math.Max(confusionMatrix.PredictedClassesIndicators.Count - 1, 0).ToString().Length;
Evaluators\Metrics\ConfusionMatrix.cs (2)
116_host.CheckParam(predictedClassIndicatorIndex > -1 && predictedClassIndicatorIndex < Counts.Count, 118_host.CheckParam(actualClassIndicatorIndex > -1 && actualClassIndicatorIndex < Counts.Count,
Transforms\ColumnBindingsBase.cs (2)
754Contracts.Assert(index < AddedColumnIndices.Count); 778Contracts.Assert(-AddedColumnIndices.Count <= src && src < InputSchema.Count);
Transforms\ColumnConcatenatingTransformer.cs (2)
446int[] sources = new int[_parent._columns[iinfo].Sources.Count]; 463for (int i = 0; i < _parent._columns[iinfo].Sources.Count; i++)
Microsoft.ML.FastTree (2)
Utils\RegressionTreeBaseUtils.cs (2)
41for (int i = 0; i < trees.Count; i++) 122for (int i = 0; i < quantileTrees.Count; i++)
Microsoft.ML.GenAI.Core (1)
Trainer\CausalLMDataset.cs (1)
86var enumerable = Enumerable.Range(0, labelIds.Count)
Microsoft.ML.IntegrationTests (16)
Explainability.cs (1)
105Assert.Equal(HousingRegression.Features.Length, weights.Count);
IntrospectiveTraining.cs (14)
52Assert.Equal(3, treeCollection.Trees.Count); 53Assert.Equal(3, treeCollection.TreeWeights.Count); 59Assert.Equal(tree.SplitGains.Count, tree.NumberOfNodes); 60Assert.Equal(tree.NumericalSplitThresholds.Count, tree.NumberOfNodes); 96Assert.Equal(3, treeCollection.Trees.Count); 97Assert.Equal(3, treeCollection.TreeWeights.Count); 103Assert.Equal(tree.SplitGains.Count, tree.NumberOfNodes); 104Assert.Equal(tree.NumericalSplitThresholds.Count, tree.NumberOfNodes); 160Assert.Equal(shapeFunctionBins.Count, shapeFunctionValues.Count); 161Common.AssertFiniteNumbers(shapeFunctionBins as IList<double>, shapeFunctionBins.Count - 1); 198Assert.Equal(numTopics, ldaDetails.ItemScoresPerTopic.Count); 200Assert.Equal(numTopics, ldaDetails.WordScoresPerTopic.Count); 245Assert.Equal(numFeatures, weights.Count);
Validation.cs (1)
51Assert.Equal(5, cvResult.Count);
Microsoft.ML.Maml (2)
HelpCommand.cs (2)
314if (names.Count <= 1) 318for (int i = 1; i < names.Count; i++)
Microsoft.ML.OnnxTransformer (1)
OnnxTransform.cs (1)
698Contracts.Assert(outputCache.OutputOnnxValues.Count > 0);
Microsoft.ML.PerformanceTests (1)
Harness\Metrics.cs (1)
55if (results.Count != 1)
Microsoft.ML.Samples (4)
Dynamic\Trainers\BinaryClassification\Gam.cs (1)
77for (int j = 0; j < binUpperBounds.Count; j++)
Dynamic\Trainers\BinaryClassification\GamWithOptions.cs (1)
85for (int j = 0; j < binUpperBounds.Count; j++)
Dynamic\Trainers\Regression\GamAdvanced.cs (1)
77for (int j = 0; j < binUpperBounds.Count; j++)
Dynamic\Trainers\Regression\GamWithOptionsAdvanced.cs (1)
85for (int j = 0; j < binUpperBounds.Count; j++)
Microsoft.ML.StandardTrainers (2)
FactorizationMachine\FieldAwareFactorizationMachineModelParameters.cs (1)
374for (int i = 0; i < FeatureColumns.Count; i++)
Optimizer\LearningRateScheduler.cs (1)
112for (int i = 0; i < _lrSchedule.Count; i++)
Microsoft.ML.Tests (14)
PermutationFeatureImportanceTests.cs (6)
579for (int i = 0; i < pfi[0].PerClassLogLoss.Count; i++) 656for (int i = 0; i < pfi[0].PerClassLogLoss.Count; i++) 721for (int i = 0; i < pfi[0].DiscountedCumulativeGains.Count; i++) 726for (int i = 0; i < pfi[0].NormalizedDiscountedCumulativeGains.Count; i++) 792for (int i = 0; i < pfi[0].DiscountedCumulativeGains.Count; i++) 797for (int i = 0; i < pfi[0].NormalizedDiscountedCumulativeGains.Count; i++)
Scenarios\IrisPlantClassificationTests.cs (1)
95Assert.Equal(3, metrics.PerClassLogLoss.Count);
Scenarios\IrisPlantClassificationWithStringLabelTests.cs (1)
98Assert.Equal(3, metrics.PerClassLogLoss.Count);
ScenariosWithDirectInstantiation\IrisPlantClassificationTests.cs (1)
100Assert.Equal(3, metrics.PerClassLogLoss.Count);
TrainerEstimators\MatrixFactorizationTests.cs (5)
93Assert.Equal(leftMatrix.Count, model.Model.NumberOfRows * model.Model.ApproximationRank); 94Assert.Equal(rightMatrix.Count, model.Model.NumberOfColumns * model.Model.ApproximationRank); 102Assert.Equal(0.468956589698792, leftMatrix[leftMatrix.Count - 1], 0.0001); 104Assert.Equal(0.503888845443726, rightMatrix[rightMatrix.Count - 1], 0.0001); 828for (int i = 0; i < leftFactorMatrix.Count; ++i)
Microsoft.ML.TimeSeries (30)
Deseasonality.cs (1)
120for (int i = 0; i < _stl.Residual.Count; ++i)
STL\FastLoess.cs (2)
46if (yValues.Count < MinTimeSeriesLength) 51_length = _y.Count;
STL\InnerStl.cs (6)
122if (yValues.Count < MinTimeSeriesLength) 125int length = yValues.Count; 181for (int i = 0; i < y.Count; i++) 258for (int i = 0; i < y.Count; i++) 313List<double> results = new List<double>(s.Count); 320for (int i = length; i < s.Count; ++i)
STL\LeastSquares.cs (7)
31if (x.Count == 0 || y.Count == 0) 33if (x.Count != y.Count) 37_length = _x.Count; 48Contracts.CheckParam(weights.Count == _length, nameof(weights)); 49if (weights.Count != _length)
STL\LocalRegression.cs (4)
41if (x.Count <= 1 || x.Count != y.Count) 48_length = _x.Count;
STL\Loess.cs (5)
52if (xValues.Count < MinTimeSeriesLength || yValues.Count < MinTimeSeriesLength) 55if (xValues.Count != yValues.Count) 60_length = xValues.Count;
STL\MathsTools.cs (3)
35double[] left = new double[values.Count]; 36double[] right = new double[values.Count]; 37int numsCount = nums.Count;
STL\PolynomialModel.cs (2)
41for (int i = 1; i < Coeffs.Count; i++) 64Contracts.CheckParam(coeffs.Count == 2, nameof(coeffs), "must contain exact 2 elements.");
Microsoft.ML.Tokenizers (15)
Model\CodeGenTokenizer.cs (2)
1593if (tokensToAdd.Count > 0) 1598for (int i = 1; i < tokensToAdd.Count; i++)
Model\EnglishRobertaTokenizer.cs (7)
836List<int> list = new List<int>(ids.Count); 858List<int> list = new List<int>(ids.Count); 880List<int> list = new List<int>(ranks.Count); 915for (int i = 0; i < tokens.Count; i++) 921List<EncodedToken> list = new List<EncodedToken>(tokens.Count); 927for (int j = i; j < tokens.Count; j++) 1065if (word.Count <= 1)
Model\SentencePieceTokenizer.cs (1)
78if (specialTokens is not null && specialTokens.Count > 0)
PreTokenizer\RegexPreTokenizer.cs (1)
36if (specialTokens is { Count: > 0 })
Tokenizer.cs (4)
46var ids = new int[results.Tokens.Count]; 184=> EncodeToTokens(text, textSpan, settings).Tokens.Count; 237tokenCount = Math.Min(maxTokenCount, tokens.Tokens.Count); 253var token = tokens.Tokens[tokens.Tokens.Count - tokenCount];
Microsoft.ML.Tokenizers.Tests (109)
BertTokenizerTests.cs (23)
383ids1Span = stackalloc int[ids1.Count + 2]; 386Assert.Equal(ids1.Count + 2, written); 398ids1Span = stackalloc int[ids1.Count + ids2.Count + 3]; 421ids1Span = stackalloc int[ids1.Count + 2]; 438ids1Span = stackalloc int[ids1.Count + ids2.Count + 3]; 483ids1Span = stackalloc int[ids1.Count]; 486Assert.Equal(ids1.Count, written); 498ids1Span = stackalloc int[ids1.Count + ids2.Count]; 501Assert.Equal(ids1.Count + ids2.Count, written); 518ids1Span = stackalloc int[ids1.Count + 2]; 521Assert.Equal(ids1.Count + 2, written); 533ids1Span = stackalloc int[ids1.Count + ids2.Count + 3]; 536Assert.Equal(ids1.Count + ids2.Count + 3, written); 576ids1Span = stackalloc int[ids1.Count + 2]; 579Assert.Equal(ids1.Count + 2, written); 591ids1Span = stackalloc int[ids1.Count + ids2.Count + 3];
BpeTests.cs (6)
261Assert.Equal(expectedTokens.Length, encoding.Count); 262Assert.Equal(offsets.Length, encoding.Count); 263Assert.Equal(ids.Length, encoding.Count); 264Assert.Equal(ids.Length, idsList.Count); 274for (int i = 0; i < encoding.Count; i++) 379Assert.Equal(12, encoding.Count);
CodeGenTests.cs (38)
691Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 696Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 701Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 706Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 715Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 720Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 725Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 730Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 735Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 740Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 743Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 745Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 747Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 749Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 751Assert.NotEqual(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 753Assert.NotEqual(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 755Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 757Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 827Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 833Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 839Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 845Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 857Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 863Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 869Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 875Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 881Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 887Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 891Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 894Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 897Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 900Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 903Assert.NotEqual(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 906Assert.NotEqual(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 909Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 912Assert.Equal(codeGenTokenizer.EndOfSentenceId.Value, ids[ids.Count - 1]); 998Assert.Equal(expectedTokenCount, ids.Count); 1003Assert.Equal(expectedTokenCount, ids.Count);
LlamaTests.cs (12)
360Assert.True(bpe.Vocabulary.Count > 0); 673Assert.Equal(tokenCount, encodedTokens.Count); 689for (int i = 1; i <= encodedTokens.Count; i++) 697accumulatedStringFromEnd = (encodedTokens.Count == i ? DummyPrefix : (i % 2 == 0 ? $"{DummyPrefix}Hello" : specialTokens[specialTokens.Length - 1 - (i / 2)])) + accumulatedStringFromEnd; 849Assert.True(idsConsumed < ids.Count); 854Assert.Equal(ids.Count, idsConsumed); 863Assert.True(idsConsumed < ids.Count); 868Assert.Equal(ids.Count, idsConsumed); 888Assert.True(idsConsumed < ids.Count); 893Assert.Equal(ids.Count, idsConsumed); 902Assert.True(idsConsumed < ids.Count); 912Assert.Equal(ids.Count, idsConsumed);
PreTokenizerTests.cs (2)
67Assert.True(encoding.Count >= splitParts.Length, $"Expected to have {encoding.Count} >= {splitParts.Length}");
TiktokenTests.cs (19)
122Assert.Equal(externalEncoder.Count, encoder.Count); 152Assert.Equal(encoded.Count, idsCount); 206Assert.Equal(encoded.Count, idsCount); 214Assert.Equal(5584, encoded.Count); 216Assert.Equal(encoded.Count, idsCount); 246Assert.Equal(encoded.Count, idsCount); 276Assert.Equal(encoded.Count, idsCount); 288Assert.Equal(5609, encoded.Count); 289Assert.Equal(encoded.Count, idsCount); 311Assert.Equal(encoded.Count, idsCount); 324Assert.Equal(11378, encoded.Count); 325Assert.Equal(encoded.Count, idsCount); 343Assert.Equal(7230, encoded.Count); 344Assert.Equal(encoded.Count, idsCount); 362Assert.Equal(7230, encoded.Count); 363Assert.Equal(encoded.Count, idsCount); 381Assert.Equal(11378, encoded.Count); 382Assert.Equal(encoded.Count, idsCount);
TokenizerTests.cs (9)
135for (int i = 1; i <= fullIdsList.Count; i++) 144Assert.Equal(fullIdsList.Take(partialIdsList.Count), partialIdsList); 165Assert.Equal(tokenCount1, prefixIds.Count); 166Assert.Equal(prefixIds, fullIdsList.Take(prefixIds.Count)); 178if (i < fullIdsList.Count) 188Assert.Equal(tokenCount2, suffixIds.Count); 189Assert.Equal(suffixIds, fullIdsList.Skip(fullIdsList.Count - suffixIds.Count)); 192if (i == fullIdsList.Count)
Microsoft.ML.TorchSharp (10)
NasBert\NerTrainer.cs (5)
172if (target.Length != encoding.Count) 175var targetEditor = VBufferEditor.Create(ref target, encoding.Count); 177for (var i = 0; i < encoding.Count; i++) 387for (var i = 0; i < encoding.Count; i++) 401for (var i = 1; i < encoding.Count; i++)
Roberta\QATrainer.cs (5)
420var targetList = new List<int> { mapping[answerIndex] + 2 + questionTokenId.Count, mapping[answerEnd] + 2 + questionTokenId.Count }; 445for (var (i, j, tid) = (0, 0, 0); i < text.Length && tid < tokens.Count;) 866contextLength = contextTokenId.Count; 867questionLength = questionTokenId.Count;
Microsoft.ML.Transforms (17)
ExpressionTransformer.cs (2)
117for (int isrc = 0; isrc < inputColumnNames.Count; isrc++) 137for (int isrc = 0; isrc < inputColumnNames.Count; isrc++)
MetricStatistics.cs (6)
58Contracts.Assert(src.Count == dest.Count); 60for (int i = 0; i < dest.Count; i++) 271PerClassLogLoss = MetricsStatisticsUtils.InitializeArray(metrics.PerClassLogLoss.Count); 303DiscountedCumulativeGains = MetricsStatisticsUtils.InitializeArray(metrics.DiscountedCumulativeGains.Count); 306NormalizedDiscountedCumulativeGains = MetricsStatisticsUtils.InitializeArray(metrics.NormalizedDiscountedCumulativeGains.Count);
PermutationFeatureImportanceExtensions.cs (4)
643Contracts.Assert(a.Count == b.Count); 645var delta = new double[a.Count]; 646for (int i = 0; i < a.Count; i++)
Text\NgramTransform.cs (5)
327for (int i = 0; i < lims.Count; i++) 341env.Assert(lims.Count > 0); 342env.Assert(lims.Count == Utils.Size(counts)); 345int ngramLength = lims.Count; 351env.Assert(lim <= lims.Count);
Microsoft.VisualStudio.LanguageServices (11)
CodeCleanup\AbstractCodeCleanUpFixer.cs (1)
201progressTracker.AddItems(projects.Sum(static p => p.DocumentIds.Count));
Diagnostics\VisualStudioDiagnosticAnalyzerService.cs (1)
333var totalProjectCount = project != null ? (1 + otherProjectsForMultiTfmProject.Length) : solution.ProjectIds.Count;
EditorConfigSettings\SettingsEditorPane.SearchFilter.cs (2)
50var cachedColumnValues = new string[_visibleColumns.Count + 1]; 90for (var i = 0; i < _visibleColumns.Count; i++)
EditorConfigSettings\SettingsEditorPane.SearchTask.cs (1)
48resultCount += (uint)results.FilteredAndSortedEntries.Count;
FindReferences\Contexts\AbstractTableDataSourceFindUsagesContext.cs (2)
143Debug.Assert(_findReferencesWindow.Manager.Sources.Count == 0); 653Debug.Assert(_findReferencesWindow.Manager.Sources.Count == 1);
GenerateType\GenerateTypeDialogViewModel.cs (2)
378this.SelectedProject.Documents.Where(n => n.Name != null && n.Folders.Count > 0 && n.Name == this.FileName && this.Folders.SequenceEqual(n.Folders)).Any()) || 816if (document.Folders.Count == 0)
PreviewPane\PreviewPane.xaml.cs (2)
157if (previewItems == null || previewItems.Count == 0) 163if (previewItems.Count > MaxItems)
MinimalSample (1)
Program.cs (1)
37return $"{result} | /inner filter! Tags: {(tags.Count == 0 ? "(null)" : string.Join(", ", tags))}";
MSBuild (4)
CollectionHelpers.cs (2)
60if (a.Count != b.Count)
ErrorUtilities.cs (2)
511if (parameter.Count == 0) 522if (parameter?.Count == 0)
PresentationBuildTasks (1)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\Xaml\Parser\SpecialBracketCharacters.cs (1)
37if (attributeList is not null && attributeList.Count > 0)
PresentationCore (6)
System\Windows\BinaryFormat\ArrayRecord.cs (1)
49if (arrayInfo.Length != arrayObjects.Count)
System\Windows\BinaryFormat\ClassInfo.cs (1)
35writer.Write(MemberNames.Count);
System\Windows\BinaryFormat\ClassRecord.cs (1)
30for (int i = 0; i < ClassInfo.MemberNames.Count; i++)
System\Windows\BinaryFormat\Record.cs (2)
80for (int i = 0; i < values.Count; i++) 96for (int i = 0; i < objects.Count; i++)
System\Windows\Nrbf\SerializationRecordExtensions.cs (1)
360ArgumentOutOfRangeException.ThrowIfLessThan(readOnlyList.Count, count, nameof(count));
PresentationFramework (25)
MS\Internal\WindowsRuntime\Generated\WinRT\Projections\IReadOnlyList.cs (6)
131EnsureIndexInt32(index, _list.Count); 144public uint Size => (uint)_list.Count; 149int max = _list.Count; 174if (startIndex == _list.Count) 177EnsureIndexInt32(startIndex, _list.Count); 184uint itemCount = Math.Min((uint)items.Length, (uint)_list.Count - startIndex);
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\Xaml\Parser\SpecialBracketCharacters.cs (1)
37if (attributeList is not null && attributeList.Count > 0)
System\Windows\Documents\NLGSpellerInterop.cs (6)
230segmentCount += sentence.Segments.Count; 235for (int i = 0; continueIteration && (i < sentence.Segments.Count); i++ ) 723for (int i = 0; result && (i < SubSegments.Count); i++) 845Invariant.Assert(_segments.Count == sentenceSegmentCount); 875if (Segments.Count > 0) 877ITextRange textRange = Segments[Segments.Count - 1].TextRange;
System\Windows\Documents\Speller.cs (3)
897if (textSegment.SubSegments.Count == 0) 900if(textSegment.Suggestions.Count > 0) 951if (textSegment.SubSegments.Count == 0)
System\Windows\Documents\WinRTSpellerInterop.cs (5)
383segmentCount += sentence.Segments.Count; 387for (int i = 0; continueIteration && (i < sentence.Segments.Count); i++) 1014for (int i = 0; result && (i < SubSegments.Count); i++) 1071if (Segments.Count > 0) 1073ITextRange textRange = Segments[Segments.Count - 1].TextRange;
System\Windows\Documents\WinRTSpellerInteropExtensions.cs (4)
61if (tokens.Count == 0) 69for (int i = 0; i < tokens.Count; i++) 111if (tokens.Count > 0 && 113spellChecker.HasErrors(tokens[tokens.Count - 1].Text) &&
Roslyn.Test.PdbUtilities (1)
EditAndContinue\EditAndContinueTest.cs (1)
152for (int generation = 0; generation < exceptions.Count; generation++)
Roslyn.VisualStudio.Next.UnitTests (5)
Services\ServiceHubServicesTests.cs (5)
1480for (var i = 0; i < projectIds.Count; i++) 1487for (var j = 0; j < documentIds.Count; j++) 1585for (var i = 0; i < projectIds.Count; i++) 1597for (var j = 0; j < documentIdsInProject.Count; j++) 1726var projectName = $"Project{solution.ProjectIds.Count}";
Sample (2)
Program.cs (2)
58forms.MapPost("/form-files", (IFormFileCollection files) => Results.Ok(files.Count)); 59forms.MapPost("/form-file-multiple", (IFormFile resume, IFormFileCollection files) => Results.Ok(files.Count + resume.FileName));
SemanticSearch.BuildTask (1)
GenerateFilteredReferenceAssembliesTask.cs (1)
182for (var i = 0; i < lines.Count; i++)
Shared (5)
EmptyCollections\EmptyCollectionExtensions.cs (4)
33=> collection == null || collection.Count == 0 ? EmptyReadOnlyList<T>.Instance : collection; 63=> list == null || list.Count == 0 ? EmptyReadOnlyList<T>.Instance : list; 106if (enumerable is IReadOnlyCollection<T> rc && rc.Count == 0) 133if (dictionary == null || dictionary.Count == 0)
Throw\Throw.cs (1)
274if (readOnlyCollection.Count == 0)
Swaggatherer (4)
Template.cs (4)
19for (var i = 0; i < entries.Count; i++) 45for (var i = 0; i < entries.Count; i++) 60for (var i = 0; i < entries.Count; i++) 135entries.Count);
System.Collections.Concurrent (1)
System\Collections\Concurrent\ConcurrentDictionary.cs (1)
289IReadOnlyCollection<KeyValuePair<TKey, TValue>> rc => Math.Max(DefaultCapacity, rc.Count),
System.Collections.Immutable (20)
System\Collections\Frozen\EmptyFrozenSet.cs (1)
45other is IReadOnlyCollection<T> s ? s.Count == 0 : // TODO https://github.com/dotnet/runtime/issues/42254: Remove if/when Any includes this check
System\Collections\Frozen\FrozenSetInternalBase.cs (2)
92return _thisSet.Count <= otherAsSet.Count && IsSubsetOfSetWithCompatibleComparer(otherAsSet); 152return _thisSet.Count == otherAsSet.Count && ContainsAllElements(otherAsSet);
System\Collections\Immutable\ImmutableEnumerableDebuggerProxy.cs (1)
50??= _dictionary.Select(kv => new DebugViewDictionaryItem<TKey, TValue>(kv)).ToArray(_dictionary.Count);
System\Collections\Immutable\ImmutableExtensions.Minimal.cs (1)
49count = readOnlyCollection.Count;
System\Collections\Immutable\ImmutableList.cs (10)
149return list.IndexOf(item, 0, list.Count, EqualityComparer<T>.Default); 170return list.IndexOf(item, 0, list.Count, equalityComparer); 195return list.IndexOf(item, startIndex, list.Count - startIndex, EqualityComparer<T>.Default); 243if (list.Count == 0) 249return list.LastIndexOf(item, list.Count - 1, list.Count, EqualityComparer<T>.Default); 270if (list.Count == 0) 276return list.LastIndexOf(item, list.Count - 1, list.Count, equalityComparer); 301if (list.Count == 0 && startIndex == 0)
System\Collections\Immutable\ImmutableList_1.cs (2)
1183if (list.Count == 0) 1188Node root = Node.NodeTreeFromList(list, 0, list.Count);
System\Collections\Immutable\ImmutableList_1.Node.cs (1)
1562return NodeTreeFromList(list, 0, list.Count);
System\Collections\Immutable\ImmutableSortedDictionary_2.Node.cs (1)
236return NodeTreeFromList(list, 0, list.Count);
System\Collections\Immutable\KeysOrValuesCollectionAccessor.cs (1)
55get { return _dictionary.Count; }
System.Formats.Nrbf (3)
System\Formats\Nrbf\ArrayRectangularPrimitiveRecord.cs (2)
54for (int i = 0; i < _values.Count; i++) 77Debug.Assert(numElementsWritten == (uint)_values.Count, "We should have traversed the entirety of the source values collection.");
System\Formats\Nrbf\ClassRecord.cs (1)
38internal int ExpectedValuesCount => MemberTypeInfo.Infos.Count;
System.Linq.Expressions (41)
System\Dynamic\Utils\ExpressionUtils.cs (3)
256return current.Count == 0; 272return current.Count == 0; 289int count = current.Count;
System\Linq\Expressions\BlockExpression.cs (5)
471Debug.Assert(expressions.Count != 0); 481Debug.Assert(index >= 0 && index < _expressions.Count); 486internal override int ExpressionCount => _expressions.Count; 618internal override int ExpressionCount => _body.Count; 1090return expressions.Count switch
System\Linq\Expressions\Compiler\CompilerScope.cs (1)
102Definitions = new Dictionary<ParameterExpression, VariableStorageKind>(variables.Count);
System\Linq\Expressions\DebugViewWriter.cs (1)
262if (open == '{' || expressions.Count > 1)
System\Linq\Expressions\DynamicExpression.cs (2)
507int IArgumentProvider.ArgumentCount => _arguments.Count; 854switch (argumentList.Count)
System\Linq\Expressions\Expression.cs (1)
242for (int i = 0, n = items.Count; i < n; i++)
System\Linq\Expressions\IndexExpression.cs (3)
31Debug.Assert(instance.Type.GetArrayRank() == arguments.Count); 110public int ArgumentCount => _arguments.Count; 123Debug.Assert(arguments == null || arguments.Length == _arguments.Count);
System\Linq\Expressions\Interpreter\InstructionList.cs (1)
122for (int i = 0, n = instructions.Count; i < n; i++)
System\Linq\Expressions\InvocationExpression.cs (3)
142public override int ArgumentCount => _arguments.Count; 147Debug.Assert(arguments == null || arguments.Length == _arguments.Count); 715switch (argumentList.Count)
System\Linq\Expressions\LambdaExpression.cs (3)
311return parameters.Count switch 573internal override int ParameterCount => _parameters.Count; 585Debug.Assert(parameters == null || parameters.Length == _parameters.Count);
System\Linq\Expressions\MethodCallExpression.cs (17)
179public override int ArgumentCount => _arguments.Count; 192Debug.Assert(args == null || args.Count == _arguments.Count); 210public override int ArgumentCount => _arguments.Count; 223Debug.Assert(args == null || args.Count == _arguments.Count); 254Debug.Assert(args == null || args.Count == 0); 301Debug.Assert(args == null || args.Count == 1); 367Debug.Assert(args == null || args.Count == 2); 438Debug.Assert(args == null || args.Count == 3); 515Debug.Assert(args == null || args.Count == 4); 598Debug.Assert(args == null || args.Count == 5); 634Debug.Assert(args == null || args.Count == 0); 683Debug.Assert(args == null || args.Count == 1); 748Debug.Assert(args == null || args.Count == 2); 819Debug.Assert(args == null || args.Count == 3); 1193int argCount = argumentList.Count;
System\Linq\Expressions\NewExpression.cs (1)
61public int ArgumentCount => _arguments.Count;
System.Net.Http (2)
System\Net\Http\DiagnosticsHandler.cs (2)
34if (autoRedirect && _propagator.Fields is IReadOnlyCollection<string> fields && fields.Count > 0) 36var fieldDescriptors = new List<HeaderDescriptor>(fields.Count);
System.Private.CoreLib (6)
src\libraries\System.Private.CoreLib\src\System\IO\RandomAccess.Unix.cs (6)
63MemoryHandle[] handles = new MemoryHandle[buffers.Count]; 64Span<Interop.Sys.IOVector> vectors = buffers.Count <= IovStackThreshold ? stackalloc Interop.Sys.IOVector[IovStackThreshold] : new Interop.Sys.IOVector[buffers.Count]; 69int buffersCount = buffers.Count; 80result = Interop.Sys.PReadV(handle, pinnedVectors, buffers.Count, fileOffset); 163int buffersCount = buffers.Count;
System.Private.Windows.Core (17)
System\Collections\Generic\CollectionExtensions.cs (1)
18ArgumentOutOfRangeException.ThrowIfLessThan(readOnlyList.Count, count, nameof(count));
System\IO\BinaryReaderExtensions.cs (2)
202if (values.Count == 0) 271for (int i = 0; i < values.Count; i++)
System\IO\BinaryWriterExtensions.cs (2)
33for (int i = 0; i < memberTypeInfo.Count; i++) 38for (int i = 0; i < memberTypeInfo.Count; i++)
System\Private\Windows\BinaryFormat\Serializer\ArrayRecord.cs (1)
64if (arrayInfo.Length != arrayObjects.Count)
System\Private\Windows\BinaryFormat\Serializer\ArraySingleObject.cs (1)
23: base(new ArrayInfo(objectId, arrayObjects.Count), arrayObjects)
System\Private\Windows\BinaryFormat\Serializer\ArraySinglePrimitive.cs (1)
29: base(new ArrayInfo(objectId, arrayObjects.Count), arrayObjects)
System\Private\Windows\BinaryFormat\Serializer\ArraySingleString.cs (1)
23: base(new ArrayInfo(objectId, arrayObjects.Count), new StringListAdapter(arrayObjects, recordMap))
System\Private\Windows\BinaryFormat\Serializer\ArraySingleString.StringListAdapter.cs (2)
30int IReadOnlyCollection<string?>.Count => _recordList.Count; 38for (int i = 0; i < _recordList.Count; i++)
System\Private\Windows\BinaryFormat\Serializer\ClassInfo.cs (1)
33writer.Write(MemberNames.Count);
System\Private\Windows\BinaryFormat\Serializer\ClassRecord.cs (2)
33for (int i = 0; i < ClassInfo.MemberNames.Count; i++) 64for (int i = 0; i < memberTypeInfo.Count; i++)
System\Private\Windows\BinaryFormat\Serializer\Record.cs (1)
91for (int i = 0; i < objects.Count; i++)
System\Private\Windows\Ole\DataFormatsCore.cs (2)
57for (int i = 0; i < formats.Count; i++) 120for (int i = 0; i < formats.Count; i++)
System.Reflection.Metadata (8)
System\Reflection\Metadata\Ecma335\MetadataAggregator.cs (8)
71if (baseTableRowCounts.Count != MetadataTokens.TableCount) 81if (baseHeapSizes.Count != MetadataTokens.HeapCount) 87if (deltaReaders == null || deltaReaders.Count == 0) 92for (int i = 0; i < deltaReaders.Count; i++) 139int generationCount = 1 + deltaReaders.Count; 151for (int r = 0; r < deltaReaders.Count; r++) 171var rowCounts = GetBaseRowCounts(baseRowCounts, generations: 1 + deltaReaders.Count); 173for (int generation = 1; generation <= deltaReaders.Count; generation++)
System.Windows.Forms (17)
System\Windows\Forms\Controls\ListBoxes\ListBox.AccessibleObject.cs (1)
149if (index >= entries.Count)
System\Windows\Forms\Controls\ListView\ListView.ListViewAccessibleObject.cs (7)
100return index < visibleGroups.Count ? visibleGroups[index].AccessibilityObject : null; 113int count = owningListView.GroupsDisplayed ? GetVisibleGroups().Count : owningListView.Items.Count; 142for (int i = 0; i < visibleGroups.Count; i++) 216return visibleGroups.Count == 0 ? null : visibleGroups[visibleGroups.Count - 1].AccessibilityObject; 275&& listViewGroupAccessibleObject.GetVisibleItems().Count > 0) 297for (int i = 0; i < visibleGroups.Count; i++)
System\Windows\Forms\Controls\ListView\ListViewGroup.ListViewGroupAccessibleObject.cs (6)
144private bool IsEmpty => GetVisibleItems().Count == 0; 247return visibleItems.Count > 0 ? visibleItems[visibleItems.Count - 1].AccessibilityObject : null; 262if (index >= visibleItems.Count) 278for (int i = 0; i < visibleItems.Count; i++) 296return GetVisibleItems().Count;
System\Windows\Forms\Controls\PropertyGrid\GridItemCollection.cs (3)
25public int Count => _entries.Count; 54if (_entries.Count > 0) 56for (int i = 0; i < _entries.Count; i++)
System.Windows.Forms.Design (3)
System\Windows\Forms\Design\DesignerUtils.cs (2)
765List<IComponent> newObjects = new(objects.Count); 778Debug.Assert(newObjects.Count == objects.Count, "Why is the count of the copied objects not the same?");
System\Windows\Forms\Design\ToolStripDesigner.cs (1)
1896for (int i = 0; i < components.Count; i++)
System.Xaml (2)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\Xaml\Parser\SpecialBracketCharacters.cs (1)
37if (attributeList is not null && attributeList.Count > 0)
System\Xaml\XamlSchemaContext.cs (1)
597SpecialBracketCharacters splBracketCharacters = markupExtensionBracketCharactersList is not null && markupExtensionBracketCharactersList.Count > 0
Templates.Blazor.WebAssembly.Auth.Tests (1)
src\Shared\E2ETesting\BrowserAssertFailedException.cs (1)
32if (logs.Count > 0)
Templates.Blazor.WebAssembly.Tests (1)
src\Shared\E2ETesting\BrowserAssertFailedException.cs (1)
32if (logs.Count > 0)
Templates.Mvc.Tests (1)
src\Shared\E2ETesting\BrowserAssertFailedException.cs (1)
32if (logs.Count > 0)
Templates.Tests (1)
src\Shared\E2ETesting\BrowserAssertFailedException.cs (1)
32if (logs.Count > 0)
xunit.assert (1)
Sdk\Exceptions\AllException.cs (1)
55 errors.Count,
xunit.console (1)
common\AssemblyResolution\DependencyContextAssemblyCache.cs (1)
67.Where(lib => lib.RuntimeAssemblyGroups?.Count > 0)