2051 references to Min
Aspire.Dashboard (5)
Components\Pages\Resources.razor.cs (1)
510_maxHighlightedCount = Math.Min(maxHighlightedCount, DashboardUIHelpers.MaxHighlightedCommands);
Otlp\Model\OtlpHelpers.cs (4)
190var values = new KeyValuePair<string, string>[Math.Min(attributes.Count, context.Options.MaxAttributeCount)]; 210var readLimit = Math.Min(attributes.Count, context.Options.MaxAttributeCount); 262copyCount = Math.Min(parentAttributes.Length + attributes.Count, context.Options.MaxAttributeCount); 290var desiredCopyCount = Math.Min(attributes.Count + index, context.Options.MaxAttributeCount);
Aspire.Hosting (2)
Health\ResourceHealthCheckService.cs (1)
211: NonHealthyHealthCheckStepInterval * Math.Min(5, nonHealthyReportCount);
Publishing\PublishingActivityProgressReporter.cs (1)
326for (var i = 0; i < Math.Min(inputsInfo.Inputs.Count, responses.Length); i++)
Aspire.Hosting.Docker (1)
EnvVarEscaper.cs (1)
212var stripped = new char[Math.Min(content.Length, MaxContentLength)];
BuildActionTelemetryTable (1)
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
dotnet-svcutil-lib (50)
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\SqlUtils.cs (1)
223bNewPrec = (byte)(Math.Min(s_NUMERIC_MAX_PRECISION, Math.Max(1, lAdjust + m_bPrec)));
FrameworkFork\Microsoft.Xml\Xml\schema\BitSet.cs (1)
231int i = Math.Min(_bits.Length, other._bits.Length);
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationReader.cs (2)
506currentSize = Math.Min(currentSize * 2, MAX_ALLOC_SIZE); 527currentSize = Math.Min(block.Length, total);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CodeExporter.cs (1)
1453length = Math.Min(MaxIdentifierLength, length);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlReaderDelegator.cs (1)
626return Math.Min(context.RemainingItemCount, int.MaxValue);
FrameworkFork\System.Runtime.Serialization\System\Xml\ArrayHelper.cs (1)
66count = Math.Min(count, 256);
FrameworkFork\System.Runtime.Serialization\System\Xml\EncodingStreamWrapper.cs (2)
340int max = offset + Math.Min(count, BufferLength); 508int inputCount = Math.Min(count, BufferLength * 2);
FrameworkFork\System.Runtime.Serialization\System\Xml\ValueHandle.cs (4)
627actual = Math.Min(_length, count); 637int charCount = Math.Min(count / 3 * 4, _length); 707actualByteCount = Math.Min(charCount, byteCount); 772int charCount = Math.Min(count, _length / sizeof(char));
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBaseReader.cs (5)
1167actual = Math.Min(count, value.Length); 1199return ReadBytes(Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), false); 1363return ReadBytes(Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), true); 1372int actual = Math.Min(_trailByteCount, byteCount); 1442int actual = Math.Min(_trailByteCount, byteCount);
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryReader.cs (10)
1228int actual = Math.Min(count, _arrayCount); 1260int actual = Math.Min(count, _arrayCount); 1292int actual = Math.Min(count, _arrayCount); 1324int actual = Math.Min(count, _arrayCount); 1356int actual = Math.Min(count, _arrayCount); 1388int actual = Math.Min(count, _arrayCount); 1420int actual = Math.Min(count, _arrayCount); 1447int actual = Math.Min(count, _arrayCount); 1474int actual = Math.Min(count, _arrayCount); 1501int actual = Math.Min(count, _arrayCount);
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryReaderSession.cs (1)
51XmlDictionaryString[] newStrings = new XmlDictionaryString[Math.Min(Math.Max(id + 1, _strings.Length * 2), MaxArrayEntries)];
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBufferReader.cs (4)
168TryEnsureBytes(Math.Min(count, _windowOffsetMax - offset)); 970int length = Math.Min(byteLength, charLength); 984int length = Math.Min(byteLength, charLength); 1016int length = Math.Min(length1, length2);
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlStreamNodeWriter.cs (1)
471int toCopy = Math.Min(newBytes.Length, (int)(bytesMax - bytes));
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlUTF8TextWriter.cs (2)
759int byteCount = Math.Min(bufferLength / 4 * 3, count - count % 3); 780int byteCount = Math.Min(bufferLength / 4 * 3, count - count % 3);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\BufferedWriteStream.cs (2)
85byte[] shadowBuffer = new byte[Math.Min(_bufferSize + _bufferSize, MaxShadowBufferSize)]; 237int bytesToWrite = Math.Min(_bufferSize - _writePos, count);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\Connection.cs (3)
160int bytesToCopy = Math.Min(size, _preReadCount); 176int bytesToCopy = Math.Min(size, _preReadCount); 381AsyncCompletionResult asyncCompletionResult = _connection.BeginRead(0, Math.Min(count, _connection.AsyncReadBufferSize),
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrSocketConnection.cs (1)
536size = Math.Min(bytesToWrite, maxSocketWrite);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\FramingChannels.cs (2)
453Math.Min(FaultStringDecoder.FaultSizeQuota, connection.AsyncReadBufferSize), 479Math.Min(FaultStringDecoder.FaultSizeQuota, connection.AsyncReadBufferSize),
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MaxMessageSizeStream.cs (1)
105return Math.Min(bytesToRead, (int)(_maxMessageSize - _totalBytesRead));
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageEncoder.cs (2)
62int currentBufferSize = Math.Min(buffer.Length, maxBufferSize); 81currentBufferSize = Math.Min(currentBufferSize * 2, maxBufferSize);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ProducerConsumerStream.cs (1)
273int bytesToCopy = Math.Min(_count, srcCount);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (1)
494_receiveBufferSize = Math.Min(WebSocketHelper.GetReceiveBufferSize(_maxReceivedMessageSize), _maxBufferSize);
FrameworkFork\System.ServiceModel\System\ServiceModel\XmlBuffer.cs (1)
63int initialBufferSize = Math.Min(512, maxBufferSize);
GenerateDocumentationAndConfigFiles (39)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
http2cat (8)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (2)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity); 84int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (4)
425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IIS.FunctionalTests (8)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (2)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity); 84int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (4)
425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IIS.LongTests (8)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (2)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity); 84int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (4)
425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IIS.NewHandler.FunctionalTests (8)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (2)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity); 84int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (4)
425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IIS.NewShim.FunctionalTests (8)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (2)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity); 84int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (4)
425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IIS.ShadowCopy.Tests (2)
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IISExpress.FunctionalTests (8)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (2)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity); 84int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (4)
425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
InMemory.FunctionalTests (1)
src\Servers\Kestrel\shared\test\StringExtensions.cs (1)
15return s.Substring(0, Math.Min(128, s.Length))
Metrics (40)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
99rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Metrics.Legacy (40)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
99rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Microsoft.Arcade.Test.Common (2)
DiffUtil.cs (2)
263d[i, j] = Math.Min(Math.Min(m1, m2), m3);
Microsoft.AspNetCore.App.Analyzers (1)
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxNode.cs (1)
102start = Math.Min(token.VirtualChars[0].Span.Start, start);
Microsoft.AspNetCore.Authentication.Cookies (1)
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (1)
206var length = Math.Min(dataSizePerCookie, remainingLength);
Microsoft.AspNetCore.Components.QuickGrid (1)
QuickGrid.razor.cs (1)
355count = Math.Min(request.Count, Pagination.ItemsPerPage - request.StartIndex);
Microsoft.AspNetCore.Components.Server (3)
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\BufferWriter.cs (1)
239var writable = Math.Min(bytesLeftToCopy, _span.Length);
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackReader.cs (1)
1109int bytesRead = Math.Min(remainingByteLength, this.reader.UnreadSpan.Length);
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReader.cs (1)
484int toCopy = Math.Min(nextSpan.Length, destination.Length - copied);
Microsoft.AspNetCore.Components.Web (4)
Routing\NavLink.cs (1)
176minPos = Math.Min(queryStartPos, fragmentStartPos);
Virtualization\Virtualize.cs (3)
229var lastItemIndex = Math.Min(_itemsBefore + _visibleItemCapacity, _itemCount); 231var placeholdersBeforeCount = Math.Min(_loadedItemsStartIndex, lastItemIndex); 359int val => Math.Min(val, MaxItemCount),
Microsoft.AspNetCore.CookiePolicy.Test (1)
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (1)
206var length = Math.Min(dataSizePerCookie, remainingLength);
Microsoft.AspNetCore.Cryptography.KeyDerivation (1)
PBKDF2\ManagedPbkdf2Provider.cs (1)
58int numBytesToCopy = Math.Min(numBytesRemaining, T_blockIndex.Length);
Microsoft.AspNetCore.DataProtection (2)
SP800_108\ManagedSP800_108_CTR_HMACSHA512.cs (2)
112var numBytesToCopyThisIteration = Math.Min(prfOutputSizeInBytes, outputCount); 117var bytesToWrite = Math.Min(numBytesToCopyThisIteration, operationSubkey.Length - operationSubKeyIndex);
Microsoft.AspNetCore.Diagnostics.Middleware (1)
Buffering\IncomingRequestLogBuffer.cs (1)
118int currentBatchSize = Math.Min(MaxBatchSize, numItemsToEmit - offset);
Microsoft.AspNetCore.Http.Connections.Tests (1)
TestWebSocketConnectionFeature.cs (1)
155length = Math.Min(buffer.Count - buffer.Offset, _internalBuffer.Buffer.Length);
Microsoft.AspNetCore.Http.Tests (1)
Features\FormFeatureTests.cs (1)
620var toWrite = Math.Min(size - written, bytes.Length);
Microsoft.AspNetCore.HttpLogging (3)
BufferingStream.cs (1)
186var adjustedToMaximumSize = Math.Min(maxBufferSize, sizeHint);
RequestBufferingStream.cs (1)
94var innerCount = Math.Min(remaining, span.Length);
ResponseBufferingStream.cs (1)
85var innerCount = Math.Min(remaining, span.Length);
Microsoft.AspNetCore.Identity.FunctionalTests (1)
src\Identity\Extensions.Core\src\Base32.cs (1)
96var bits = Math.Min(5 - bitIndex, 8 - outputBits);
Microsoft.AspNetCore.Mvc.Core (1)
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (1)
206var length = Math.Min(dataSizePerCookie, remainingLength);
Microsoft.AspNetCore.Mvc.TagHelpers (1)
CacheTagHelper.cs (1)
264var pageLength = Math.Min(length, page.Length);
Microsoft.AspNetCore.Mvc.ViewFeatures (3)
Buffers\PagedBufferedTextWriter.cs (1)
57var pageLength = Math.Min(length, page.Length);
Buffers\PagedCharBuffer.cs (2)
60var copyLength = Math.Min(count, page.Length - _charIndex); 81var copyLength = Math.Min(count, page.Length - _charIndex);
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (1)
DefaultHtmlGeneratorTest.cs (1)
281Assert.Equal(Math.Min(ModelWithMaxLengthMetadata.MaxLengthAttributeValue, ModelWithMaxLengthMetadata.StringLengthAttributeValue), int.Parse(attribute.Value, CultureInfo.InvariantCulture));
Microsoft.AspNetCore.OpenApi.SourceGenerators (1)
Helpers\StringExtensions.cs (1)
40minLeadingWhitespace = Math.Min(minLeadingWhitespace, leadingWhitespace);
Microsoft.AspNetCore.OutputCaching (2)
FormatterBinaryWriter.cs (1)
200var toWrite = Math.Min(value.Length, available.Length);
RecyclableSequenceBuilder.cs (1)
100var toWrite = Math.Min(buffer.Length, available.Length);
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (4)
EndToEndBenchmarks.cs (4)
83var bytes = Math.Min(rand.Next(4, 1024), value.Length); 96var bytes = Math.Min(rand.Next(4, 1024), value.Length); 98bytes = Math.Min(bytes, span.Length); 111var bytes = Math.Min(rand.Next(4, 1024), value.Length);
Microsoft.AspNetCore.ResponseCaching (1)
src\Shared\SegmentWriteStream.cs (1)
143var bytesWritten = Math.Min(buffer.Length, _segmentSize - (int)_bufferStream.Length);
Microsoft.AspNetCore.Routing.Microbenchmarks (1)
Matching\JumpTableMultipleEntryBenchmark.cs (1)
158var text = guid.Substring(0, Math.Max(5, Math.Min(i, 36)));
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (8)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (2)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity); 84int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (4)
425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
Microsoft.AspNetCore.Server.IIS (2)
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
Microsoft.AspNetCore.Server.Kestrel.Core (15)
Internal\Http\HttpParser.cs (1)
253var stopIndex = Math.Min(crIndex + 2, span.Length);
Internal\Http2\Http2Connection.cs (1)
189StreamPool = new PooledStreamStack<Http2Stream>(Math.Min(InitialStreamPoolSize, http2Limits.MaxStreamsPerConnection));
Internal\Http2\Http2FrameWriter.cs (1)
619var currentSize = Math.Min(dataToFrame.Length, _maxFrameSize);
Internal\Infrastructure\HttpUtilities.cs (1)
181for (var i = 0; i < Math.Min(span.Length, maxChars); i++)
Internal\Infrastructure\PipeWriterHelpers\ConcurrentPipeWriter.cs (1)
398var adjustedToMaximumSize = Math.Min(maxBufferSize, sizeHint);
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (2)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity); 84int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (4)
425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\runtime\Http3\QPack\QPackDecoder.cs (2)
287int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 373int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex);
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (4)
CertificatePathWatcherTests.cs (1)
100Assert.Equal(Math.Min(dirCount, fileCount), watcher.TestGetDirectoryWatchCountUnsynchronized());
src\Servers\Kestrel\shared\test\StringExtensions.cs (1)
15return s.Substring(0, Math.Min(128, s.Length))
src\Shared\test\Shared.Tests\runtime\Http2\DynamicTableTest.cs (1)
190int expectedCount = Math.Min(finalMaxSize / 64, headers.Count);
src\Shared\test\Shared.Tests\runtime\Http3\QPackDecoderTest.cs (1)
343int resolvedSize = Math.Min(encoded.Length - i, chunkSize);
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (2)
SchedulerBenchmark.cs (1)
20private static readonly int IOQueueCount = Math.Min(Environment.ProcessorCount, 16);
src\Servers\Kestrel\Transport.Sockets\src\Internal\IOQueue.cs (1)
91return Math.Min(processorCount, 16);
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
NamedPipeTransportOptions.cs (1)
21public int ListenerQueueCount { get; set; } = Math.Min(Environment.ProcessorCount, 16);
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
Internal\IOQueue.cs (1)
91return Math.Min(processorCount, 16);
Microsoft.AspNetCore.Shared.Tests (16)
runtime\Http2\DynamicTableTest.cs (1)
190int expectedCount = Math.Min(finalMaxSize / 64, headers.Count);
runtime\Http3\QPackDecoderTest.cs (1)
343int resolvedSize = Math.Min(encoded.Length - i, chunkSize);
SegmentWriteStreamTests.cs (3)
60var expectedSegmentSize = Math.Min(segmentSize, WriteData.Length - i); 84stream.Write(WriteData, i, Math.Min(writeSize, WriteData.Length - i)); 93var expectedSegmentSize = Math.Min(segmentSize, WriteData.Length - i);
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (2)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity); 84int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (4)
425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\runtime\Http3\QPack\QPackDecoder.cs (2)
287int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 373int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex);
src\Shared\SegmentWriteStream.cs (1)
143var bytesWritten = Math.Min(buffer.Length, _segmentSize - (int)_bufferStream.Length);
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
Microsoft.AspNetCore.TestHost (1)
TestWebSocket.cs (1)
141int count = Math.Min(buffer.Count, receiveMessage.Buffer.Count);
Microsoft.AspNetCore.WebSockets (1)
HandshakeHelpers.cs (1)
206parsedOptions.ServerMaxWindowBits = Math.Min(parsedServerMaxWindowBits ?? 15, serverMaxWindowBits);
Microsoft.AspNetCore.WebSockets.Tests (2)
BufferStream.cs (2)
133int actualCount = Math.Min(count, _topBuffer.Count); 197var actualCount = Math.Min(count, _topBuffer.Count);
Microsoft.AspNetCore.WebUtilities (14)
BufferedReadStream.cs (2)
209int toCopy = Math.Min(_bufferCount, count); 231int toCopy = Math.Min(_bufferCount, buffer.Length);
FileBufferingReadStream.cs (2)
284var rentedBuffer = _bytePool.Rent(Math.Min((int)oldBuffer.Length, _maxRentedBufferSize)); 359var rentedBuffer = _bytePool.Rent(Math.Min((int)oldBuffer.Length, _maxRentedBufferSize));
HttpResponseStreamWriter.cs (3)
629var remaining = Math.Min(_charBufferSize - _charBufferCount, count); 644var remaining = Math.Min(_charBufferSize - _charBufferCount, count); 660var remaining = Math.Min(_charBufferSize - _charBufferCount, value.Length);
MultipartReaderStream.cs (6)
187var slice = buffer.AsSpan(offset, Math.Min(count, index)); 207read = _innerStream.Read(buffer, offset, Math.Min(count, matchOffset - bufferedData.Offset)); 218read = _innerStream.Read(buffer, offset, Math.Min(count, bufferedData.Count)); 267var slice = buffer[..Math.Min(buffer.Length, index)]; 290var slice = buffer[..Math.Min(buffer.Length, matchOffset - bufferedData.Offset)]; 304read = _innerStream.Read(buffer.Span[..Math.Min(buffer.Length, bufferedData.Count)]);
PagedByteBuffer.cs (1)
53var copyLength = Math.Min(memory.Length, currentPage.Length - _currentPageIndex);
Microsoft.Build (20)
BackEnd\Components\Communications\NodeProviderOutOfProcBase.cs (2)
805int lengthToWrite = Math.Min(writeStreamLength - i, MaxPacketWriteSize); 893delay = Math.Min(delay * 2, 500);
BackEnd\Components\RequestBuilder\TaskHost.cs (1)
875coresBeingReleased = Math.Min(coresBeingReleased, _additionalAcquiredCores);
BackEnd\Components\Scheduler\Scheduler.cs (3)
609int grantedCores = Math.Min(requestedCores, availableCores); 1573inProcNodesToCreate = Math.Min(availableNodesWithInProcAffinity, inProcNodesToCreate); 1605outOfProcNodesToCreate = Math.Min(maxCreatableOutOfProcNodes, outOfProcNodesToCreate);
BackEnd\Components\Scheduler\SchedulingData.cs (1)
680coresToRemove = Math.Min(request.GrantedCores, coresToRemove);
Definition\Project.cs (2)
2983string displayValue = escapedValue.Substring(0, Math.Min(escapedValue.Length, 75)) + ((escapedValue.Length > 75) ? "..." : String.Empty); 2990string displayOriginalValue = originalValue.Substring(0, Math.Min(originalValue.Length, 75)) + ((originalValue.Length > 75) ? "..." : String.Empty);
FileMatcher.cs (2)
1006dop = Math.Min(taskOptions.MaxTasksPerIteration, taskOptions.AvailableTasks); 2553int compareLength = Math.Min(
Logging\BinaryLogger\Postprocessing\SubStream.cs (4)
49count = Math.Min((int)Math.Max(Length - _position, 0), count); 72count = Math.Min((int)Math.Max(Length - _position, 0), count); 87buffer = buffer.Slice(0, Math.Min((int)Math.Max(Length - _position, 0), buffer.Length)); 95buffer = buffer.Slice(0, Math.Min((int)Math.Max(Length - _position, 0), buffer.Length));
Logging\LogFormatter.cs (1)
53int prettyLength = System.Math.Min(11, rawTimeLength);
Logging\ParallelLogger\ConsoleOutputAligner.cs (1)
110int remainingCharsToEndOfBuffer = Math.Min(bufferWidthMinusNewLine - cursor, count - endIndex);
Logging\TerminalLogger\Terminal.cs (1)
157ReadOnlySpan<char> truncatedText = text.Slice(0, Math.Min(text.Length, Width - 1));
Logging\TerminalLogger\TerminalLogger.cs (1)
1320int length = Math.Min(maxLength - indent.Length, text.Length - start);
Logging\TerminalLogger\TerminalNodesFrame.cs (1)
28Width = Math.Min(width, MaxColumn);
Microsoft.Build.Framework (10)
SegmentedArray.cs (10)
488var currentSegmentLength = Math.Min(remainingInSegment, _length); 497var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 592var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 640var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 730_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 737_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 779_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 786_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.Build.Tasks.Core (8)
FileMatcher.cs (2)
1006dop = Math.Min(taskOptions.MaxTasksPerIteration, taskOptions.AvailableTasks); 2553int compareLength = Math.Min(
GenerateResource.cs (2)
736int maxCount = Math.Min(inputsToProcess.Count, outputsToProcess.Count); 737maxCount = Math.Min(maxCount, 5); // Limit to just 5
Hash.cs (1)
86int charsToProcess = Math.Min(itemSpec.Length - itemSpecPosition, MaxInputChunkLength);
NodePipeBase.cs (2)
104int lengthToWrite = Math.Min(messageLength - i, MaxPacketWriteSize); 155int lengthToWrite = Math.Min(messageLength - i, MaxPacketWriteSize);
StreamMappedString.cs (1)
388charactersExtracted = Math.Min(length - i, charactersOnPage - relativeStartPosition);
Microsoft.Build.UnitTests.Shared (2)
ObjectModelHelpers.cs (2)
287int minimumLength = Math.Min(expectedItems.Length, items.Count); 1946for (int i = 0; i < Math.Min(actualLines.Length, expectedLines.Length); i++)
Microsoft.Build.Utilities.Core (2)
FileMatcher.cs (2)
1006dop = Math.Min(taskOptions.MaxTasksPerIteration, taskOptions.AvailableTasks); 2553int compareLength = Math.Min(
Microsoft.CodeAnalysis (72)
CaseInsensitiveComparison.cs (2)
111int len = Math.Min(str1.Length, str2.Length); 127int len = Math.Min(str1.Length, str2.Length);
CodeGen\LocalScopeManager.cs (6)
269begin = Math.Min(begin, bounds.Begin); 293begin = Math.Min(begin, bounds.Begin); 441begin = Math.Min(begin, block.Start); 452begin = Math.Min(begin, nestedBounds.Begin); 486begin = Math.Min(begin, block.Start); 497begin = Math.Min(begin, nestedBounds.Begin);
CodeGen\PrivateImplementationDetails.cs (1)
358previousText[..Math.Min(previousText.Length, 500)]));
CodeGen\StateMachineStateDebugInfo.cs (1)
74firstUnusedDecreasingStateMachineState = (firstUnusedDecreasingStateMachineState != null) ? (StateMachineState)Math.Min((int)firstUnusedDecreasingStateMachineState.Value, (int)minState) : minState;
Collections\ImmutableMemoryStream.cs (1)
71int result = Math.Min(count, _array.Length - _position);
Collections\Rope.cs (1)
105wrote = Math.Min(maxLength, _value.Length);
DiagnosticAnalyzer\AnalyzerDriver.cs (1)
1517var workerCount = prePopulatedEventQueue ? Math.Min(CompilationEventQueue.Count, _workerCount) : _workerCount;
DiaSymReader\Metadata\SymWriterMetadataAdapter.cs (1)
111int adjustedLength = Math.Min(nameStr.Length, nameBufferLength - 1);
DiaSymReader\Utilities\ComMemoryStream.cs (5)
57bytesToCopy = Math.Min(chunk.Length, remainingBytes); 87bytesToCopy = Math.Min(chunk.Length, remainingBytes); 121int bytesToCopy = Math.Min(_length - _position, Math.Min(cb, _chunkSize - chunkOffset)); 215int bytesToCopy = Math.Min(cb, _chunkSize - chunkOffset);
DiaSymReader\Utilities\InteropUtilities.cs (1)
50*qualifiedNameLength = Math.Min(fullLength, Math.Max(0, qualifiedNameBufferLength - 1));
DocumentationComments\XmlDocumentationCommentTextReader.XmlStream.cs (1)
134int charCount = Math.Min(src.Length - srcIndex, destCount);
Emit\EditAndContinue\DeltaMetadataWriter.cs (1)
147userStringHeapStartOffset: Math.Min(MetadataHelpers.UserStringHeapCapacity, previousGeneration.UserStringStreamLength),
Emit\EditAndContinueMethodDebugInformation.cs (2)
75int end = Math.Min(data.Length, offset + maxReportedLength / 2); 372int syntaxOffsetBaseline = Math.Min(StateMachineStates.Min(state => state.SyntaxOffset), 0);
FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
InternalUtilities\ReadOnlyUnmanagedMemoryStream.cs (1)
37int bytesRead = Math.Min(count, _length - _position);
SourceGeneration\GeneratorDriverCache.cs (2)
55for (i = Math.Min(i, MaxCacheSize - 1); i > 0; i--) 60_cacheSize = Math.Min(MaxCacheSize, _cacheSize + 1);
SourceGeneration\Nodes\NodeStateTable.cs (1)
379var sharedCount = Math.Min(previousEntry.Count, outputs.Length);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Syntax\InternalSyntax\SeparatedSyntaxListBuilder.cs (1)
94_builder!.AddRange(list, this.Count, Math.Min(count * 2, list.Count));
Syntax\SeparatedSyntaxListBuilder.cs (1)
98_builder.AddRange(list, this.Count, Math.Min(count << 1, list.Count));
Syntax\SyntaxDiffer.cs (1)
796int maxChars = Math.Min(oldText.Length, newText.Length);
Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
Text\CompositeText.cs (2)
100var copyLength = Math.Min(count, segment.Length - segOffset); 158var copyLength = Math.Min(count, segment.Length - segOffset);
Text\LargeText.cs (3)
69using (var reader = new StreamReader(stream, encoding, detectEncodingFromByteOrderMarks: true, bufferSize: Math.Min(length, 4096), leaveOpen: true)) 168int charsToCopy = Math.Min(chunk.Length - chunkStartOffset, count); 203int charsToWrite = Math.Min(chunk.Length - chunkStartOffset, count);
Text\LargeTextWriter.cs (3)
27_bufferSize = Math.Min(LargeText.ChunkSize, length); 72var copy = Math.Min(remaining, count); 105var copy = Math.Min(remaining, count);
Text\SourceText.cs (9)
308bufferSize = Math.Min(maxBufferSize, length); 562int count = Math.Min(buffer.Length, end - offset); 640var charsToCopy = Math.Min(CharBufferSize, length - index); 725int position = Math.Max(Math.Min(span.Start, this.Length), 0); 726int length = Math.Min(span.End, this.Length) - position; 731int copyLength = Math.Min(buffer.Length, length); 1012var limit = Math.Min(_lineStarts.Count, lastLineNumber + 4); 1051var contentLength = Math.Min(length - position, buffer.Length); 1194var count = Math.Min(this.Length - position, CharBufferSize);
Text\SourceTextStream.cs (3)
41_charBuffer = new char[Math.Min(bufferSize, _source.Length)]; 127int length = Math.Min(count, preambleBytes.Length); 134int charsToRead = Math.Min(_charBuffer.Length, _source.Length - _sourceOffset);
Text\SubText.cs (3)
93int compositeStart = Math.Min(UnderlyingText.Length, UnderlyingSpan.Start + start); 94int compositeEnd = Math.Min(UnderlyingText.Length, compositeStart + length); 174var endInUnderlyingText = Math.Min(underlyingTextLine.EndIncludingLineBreak, _subText.UnderlyingSpan.End);
Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
Text\TextSpan.cs (3)
103int overlapEnd = Math.Min(this.End, span.End); 120int overlapEnd = Math.Min(this.End, span.End); 171int intersectEnd = Math.Min(this.End, span.End);
VersionHelper.cs (1)
193int build = Math.Min(ushort.MaxValue, (int)days.TotalDays);
Microsoft.CodeAnalysis.Analyzers (42)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
99rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Microsoft.CodeAnalysis.AnalyzerUtilities (42)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
99rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Microsoft.CodeAnalysis.BannedApiAnalyzers (42)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
99rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Microsoft.CodeAnalysis.CodeStyle (44)
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (1)
63fileHeaderStart = Math.Min(trivia.FullSpan.Start, fileHeaderStart);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
134var textSpanEndPosition = Math.Min(parenthesizedExpressionLocation.SourceSpan.End, expressionFirstLine.Span.End);
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
99rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (1)
134var parameterIndex = Math.Min(i, parameters.Length - 1);
src\Analyzers\Core\CodeFixes\AddExplicitCast\InheritanceDistanceComparer.cs (1)
72distance = Math.Min(GetInheritanceDistanceRecursive(baseType, interfaceType), distance);
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
89for (int i = 0, n = Math.Min(t1NameSegments.Length, t2NameSegments.Length); i < n; i++)
Microsoft.CodeAnalysis.Collections.Package (12)
Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.CodeAnalysis.CSharp (25)
Binder\Binder.cs (2)
965var lastSize = Math.Min(last.Length, 12); 966snippet = first.Substring(0, Math.Min(first.Length, 12)) + " ... " + last.Substring(last.Length - lastSize, lastSize);
Binder\DecisionDagBuilder.cs (2)
536int count = Math.Min(method.ParameterCount - extensionExtra, recursive.Deconstruction.Length); 557int count = Math.Min(elementTypes.Length, recursive.Deconstruction.Length);
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (1)
168private int NumberArgumentsToProcess => System.Math.Min(_arguments.Length, _formalParameterTypes.Length);
BoundTree\UnboundLambda.cs (1)
940var numParametersToCheck = Math.Min(targetParameterTypes.Length, ParameterCount);
Compiler\DocumentationCommentCompiler.cs (1)
1084int minLength = Math.Min(str1.Length, str2.Length);
Emitter\EditAndContinue\CSharpDefinitionMap.cs (1)
153int slotCount = Math.Min(localSlots.Length, slotMetadata.Length);
FlowAnalysis\NullableWalker.cs (3)
8964Debug.Assert(values.Length == (useRestField ? Math.Min(tupleType.TupleElements.Length, NamedTypeSymbol.ValueTupleRestPosition) : tupleType.TupleElements.Length)); 8972n = Math.Min(n, NamedTypeSymbol.ValueTupleRestPosition - 1); 13370int n = Math.Min(Capacity, 8);
FlowAnalysis\NullableWalker_Patterns.cs (1)
199for (int i = 0, n = Math.Min(rp.Deconstruction.Length, elements.IsDefault ? 0 : elements.Length); i < n; i++)
Parser\LanguageParser_InterpolatedString.cs (2)
222currentIndex = Math.Min(currentIndex, lineStartPosition + indentationWhitespace.Length); 299for (int i = 0, n = Math.Min(currentLineWhitespace.Length, indentationLineWhitespace.Length); i < n; i++)
Parser\Lexer_RawStringLiteral.cs (1)
396for (int i = 0, n = Math.Min(currentLineWhitespace.Length, indentationLineWhitespace.Length); i < n; i++)
Parser\QuickScanner.cs (1)
198n = Math.Min(n, i + MaxCachedTokenSize);
Parser\SlidingTextWindow.cs (2)
179int amountToRead = Math.Min(_text.Length, position + _characterWindow.Length) - position; 227int amountToRead = Math.Min(_textEnd - (_basis + _characterWindowCount),
Parser\SyntaxParser.cs (1)
141var size = Math.Min(CachedTokenArraySize, this.lexer.TextWindow.Text.Length / 2);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.TemplateSymbol.cs (1)
192int displayCount = Math.Min(this.Properties.Length, 10);
Symbols\Tuples\TupleTypeSymbol.cs (1)
800int fieldsPerType = Math.Min(arity, ValueTupleRestPosition - 1);
Syntax\SyntaxNodeRemover.cs (1)
76start = Math.Min(start, span.Start);
Syntax\SyntaxReplacer.cs (1)
152start = Math.Min(start, span.Start);
Syntax\SyntaxTreeDiagnosticEnumerator.cs (2)
63var spanStart = Math.Min(_position - leadingWidthAlreadyCounted + sdi.Offset, length); 64var spanWidth = Math.Min(spanStart + sdi.Width, length) - spanStart;
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
198var length = Math.Min(arrayCreationElements.Length - startIndex, 4);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
706position = Math.Min(position, end - 1);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
70var minimalAccessibility = (Accessibility)Math.Min((int)propertySymbol.DeclaredAccessibility, (int)setMethod.DeclaredAccessibility);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (4)
InlineRename\CSharpEditorInlineRenameService.cs (3)
125var fallbackEndLine = Math.Min(documentText.Lines.Count - 1, documentText.Lines.GetLineFromPosition(fallbackSpan.End).LineNumber + NumberOfContextLines); 131endLine = Math.Min(documentText.Lines.Count - 1, fallbackEndLine + excessAtStart); 153endLine = Math.Min(documentText.Lines.Count - 1, documentText.Lines.GetLineFromPosition(fallbackSpan.End).LineNumber + NumberOfContextLines);
StringCopyPaste\StringCopyPasteHelpers.cs (1)
529for (var n = Math.Min(commonIndentPrefix.Length, lineWhitespaceSpan.Length); commonPrefixLength < n; commonPrefixLength++)
Microsoft.CodeAnalysis.CSharp.Features (9)
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (1)
681var length = Math.Min(leadingWhitespace1.Length, leadingWhitespace2.Length);
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (1)
322var length = Math.Min(leadingWhitespace1.Length, leadingWhitespace2.Length);
EditAndContinue\SyntaxComparer.cs (2)
1606oldToken.Text, Math.Min(oldToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation), 1607newToken.Text, Math.Min(newToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation));
IntroduceVariable\CSharpIntroduceVariableService_IntroduceField.cs (2)
115index = Math.Min(index, firstChangeIndex); 154index = Math.Min(index, firstChangeIndex);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
477return Math.Min(earliestLocalFunctionCallIndex, firstStatementAffectedIndex);
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
198var length = Math.Min(arrayCreationElements.Length - startIndex, 4);
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
70var minimalAccessibility = (Accessibility)Math.Min((int)propertySymbol.DeclaredAccessibility, (int)setMethod.DeclaredAccessibility);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (1)
Diagnostics\LineSpanDirectiveTests.cs (1)
501return Math.Min(line.Start + position.Character, line.End);
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
706position = Math.Min(position, end - 1);
Microsoft.CodeAnalysis.EditorFeatures (7)
GoOrFind\AbstractGoOrFindNavigationService.cs (1)
283position = Math.Min(text.Length, position);
InlineDiagnostics\AbstractDiagnosticsTaggerProvider.cs (3)
125var length = Math.Min(Math.Max(span.Length, minimumLength), maximumLength); 128var start = Math.Max(0, Math.Min(span.Start, snapshot.Length - length)); 131return new SnapshotSpan(snapshot, start, Math.Min(start + length, snapshot.Length) - start);
Shared\Extensions\IProjectionBufferFactoryServiceExtensions.cs (1)
91var finalSpanEnd = Math.Min(line.EndIncludingLineBreak, span.End);
SignatureHelp\Controller.cs (1)
99Math.Max(Math.Min(triggerSpan.End, GetCaretPointInViewBuffer().Position), triggerSpan.Start)));
Tagging\AsynchronousViewportTaggerProvider.SingleViewportTaggerProvider.cs (1)
87endLine = Math.Min(endLine + extraLines, snapshot.LineCount - 1);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
EmbeddedLanguages\StackFrame\StackFrameParserTests.Utilities.cs (1)
120var end = Math.Min(index, originalText.Length - 1);
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (6)
src\Compilers\Core\Portable\CaseInsensitiveComparison.cs (2)
111int len = Math.Min(str1.Length, str2.Length); 127int len = Math.Min(str1.Length, str2.Length);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\Expansion.cs (1)
55int endIndex3 = Math.Min(startIndex1 + count1, startIndex2 + count2);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\TupleExpansion.cs (1)
282int n = Math.Min(cardinality, TypeHelpers.TupleFieldRestPosition - 1);
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.TypeNames.cs (1)
405int nFields = Math.Min(nTypeArgs, TypeHelpers.TupleFieldRestPosition - 1);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\TypeHelpers.cs (1)
492int n = Math.Min(cardinality, TupleFieldRestPosition - 1);
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (4)
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\Expansion.cs (1)
55int endIndex3 = Math.Min(startIndex1 + count1, startIndex2 + count2);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\TupleExpansion.cs (1)
282int n = Math.Min(cardinality, TypeHelpers.TupleFieldRestPosition - 1);
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.TypeNames.cs (1)
405int nFields = Math.Min(nTypeArgs, TypeHelpers.TupleFieldRestPosition - 1);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\TypeHelpers.cs (1)
492int n = Math.Min(cardinality, TupleFieldRestPosition - 1);
Microsoft.CodeAnalysis.Extensions.Package (14)
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Microsoft.CodeAnalysis.Features (17)
CodeLens\CodeLensReferencesService.cs (1)
95? Math.Min(progress.ReferencesCount, progress.SearchCap)
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (1)
145position = Math.Min(position, text.Length - 1);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (2)
711lineText = text.ToString(TextSpan.FromBounds(diagnostic.Span.Start, Math.Min(diagnostic.Span.Start + 120, line.End))); 1909if (areSimilar != null && matchCount < Math.Min(oldNodes.Count, newNodes.Count))
EditAndContinue\EditSession.cs (1)
214for (var i = 0; i < Math.Min(oldLineCount, newLineCount); i++)
ExtractMethod\SelectionValidator.cs (1)
101? Math.Min(initialSelectionInfo.FirstTokenInOriginalSpan.SpanStart, adjustedSpan.Start)
NavigateTo\RoslynNavigateToItem.cs (1)
263var maxCommon = Math.Min(activeFolders.Count, itemFolders.Count);
QuickInfo\IndentationHelper.cs (2)
61var spanBeforeDeletion = TextSpan.FromBounds(span.Start, Math.Min(span.End, deletion.Start)); 70span = TextSpan.FromBounds(Math.Min(deletion.End, span.End), span.End);
Snippets\RoslynLSPSnippetConverter.cs (3)
133startPosition = Math.Min(startPosition, placeholders.Min(placeholder => placeholder.StartingPositions.Min())); 137startPosition = Math.Min(startPosition, caretPosition); 140startPosition = Math.Min(startPosition, triggerLocation);
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (1)
63fileHeaderStart = Math.Min(trivia.FullSpan.Start, fileHeaderStart);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
134var textSpanEndPosition = Math.Min(parenthesizedExpressionLocation.SourceSpan.End, expressionFirstLine.Span.End);
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (1)
134var parameterIndex = Math.Min(i, parameters.Length - 1);
src\Analyzers\Core\CodeFixes\AddExplicitCast\InheritanceDistanceComparer.cs (1)
72distance = Math.Min(GetInheritanceDistanceRecursive(baseType, interfaceType), distance);
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
89for (int i = 0, n = Math.Min(t1NameSegments.Length, t2NameSegments.Length); i < n; i++)
Microsoft.CodeAnalysis.InteractiveHost (15)
Interactive\Core\InteractiveHost.Service.cs (1)
779for (int i = 0, n = Math.Min(diagnostics.Length, MaxErrorCount); i < n; i++)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Handler\SemanticTokens\SemanticTokensHelpers.cs (1)
209textSpan = TextSpan.FromBounds(Math.Min(absoluteStart, line.End), line.End);
Handler\SpellCheck\AbstractSpellCheckingHandler.cs (1)
176var batchEnd = Math.Min(batchStart + chunkSize, spans.Length);
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (42)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
99rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Microsoft.CodeAnalysis.PublicApiAnalyzers (42)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
99rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Microsoft.CodeAnalysis.ResxSourceGenerator (43)
AbstractResxGenerator.cs (1)
905var charactersToRead = Math.Min(remaining, count);
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
99rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Microsoft.CodeAnalysis.Scripting (5)
Hosting\ObjectFormatter\CommonObjectFormatter.Builder.cs (4)
32_currentLimit = Math.Min(_options.MaximumLineLength, _options.MaximumOutputLength); 81int length = Math.Min(count, CurrentRemaining); 98count = Math.Min(count, str.Length - start); 99int length = Math.Min(count, CurrentRemaining);
Hosting\ObjectFormatter\CommonObjectFormatter.Visitor.cs (1)
60return new Builder(_builderOptions.WithMaximumOutputLength(Math.Min(_builderOptions.MaximumLineLength, limit)), suppressEllipsis: true);
Microsoft.CodeAnalysis.Test.Utilities (8)
Assert\AssertEx.cs (3)
456rows[nextRow][j] = Math.Min(dist1, Math.Min(dist2, dist3)); 794var expectedString = join(itemSeparator, expected[..Math.Min(expected.Length, maxDisplayedExpectedEntries)], itemInspector);
Assert\DiffUtil.cs (2)
266d[i, j] = Math.Min(Math.Min(m1, m2), m3);
FX\ImmutableArrayTestExtensions.cs (2)
38var buffer = new byte[Math.Min(bufferSize, bytes.Length)]; 43int length = Math.Min(bufferSize, bytes.Length - offset);
Syntax\TokenUtilities.cs (1)
23var max = Math.Min(expectedTokens.Count, actualTokens.Count);
Microsoft.CodeAnalysis.Threading.Package (12)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.CodeAnalysis.UnitTests (1)
Text\CompositeTextTests.cs (1)
58for (var sourceTextCount = minSourceTextCount; sourceTextCount <= Math.Min(maxSourceTextCount, contents.Length); sourceTextCount++)
Microsoft.CodeAnalysis.VisualBasic (1)
Syntax\SyntaxReplacer.vb (1)
123start = Math.Min(start, span.Start)
Microsoft.CodeAnalysis.Workspaces (55)
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (2)
110commonRightWidth = Math.Min(commonRightWidth, oldRootWidth - commonLeftWidth.Value); 111commonRightWidth = Math.Min(commonRightWidth, newRootWidth - commonLeftWidth.Value);
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
127projectAndVisibility.visibility = (SymbolVisibility)Math.Min((int)projectAndVisibility.visibility, (int)symbol.GetResultantVisibility());
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (2)
132parameterCount = Math.Min(parameterCount, (byte)Max4BitValue); 133typeParameterCount = Math.Min(typeParameterCount, (byte)Max4BitValue);
PatternMatching\AllLowerCamelCaseMatcher.cs (1)
159var maxHumpMatchLength = Math.Min(maxPatternHumpLength, maxCandidateHumpLength);
Shared\Extensions\FileLinePositionSpanExtensions.cs (2)
77startColumn = Math.Min(startColumn, lines[startLine].SpanIncludingLineBreak.Length); 78endColumn = Math.Min(endColumn, lines[endLine].SpanIncludingLineBreak.Length);
Shared\Extensions\INamespaceSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Shared\Extensions\SourceTextExtensions.cs (3)
215var count = Math.Min(buffer.Length, length - offset); 344var totalCharsToRead = Math.Min(count, Length - Position); 353var charsToCopy = Math.Min(chunk.Length - chunkStartOffset, count);
Shared\Utilities\DocumentationComment.cs (1)
207maxPrefix = Math.Min(maxPrefix, firstNonWhitespaceOffset.Value);
Shared\Utilities\XmlFragmentParser.cs (1)
198var charCount = Math.Min(src.Length - srcIndex, destCount);
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
TemporaryStorage\TemporaryStorageService.DirectMemoryAccessStreamReader.cs (1)
66count = Math.Min(count, (int)(_end - _position));
Workspace\Solution\Checksum_Factory.cs (1)
139var count = Math.Min(maxStackAllocCount, checksumsCount - checksumsIndex);
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (19)
src\Compilers\Core\Portable\CaseInsensitiveComparison.cs (2)
111int len = Math.Min(str1.Length, str2.Length); 127int len = Math.Min(str1.Length, str2.Length);
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\InternalUtilities\ReadOnlyUnmanagedMemoryStream.cs (1)
37int bytesRead = Math.Min(count, _length - _position);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
Microsoft.Data.Analysis (5)
DataFrame.Arrow.cs (1)
198numberOfRowsInThisRecordBatch = (int)Math.Min(numberOfRowsInThisRecordBatch, column.GetMaxRecordBatchLength(numberOfRowsProcessed));
PrimitiveDataFrameColumnComputations.cs (4)
2785ret = (int)(Math.Min(readOnlySpan[i], ret)); 2829ret = (int)Math.Min(span[(int)row], ret); 3025value = (int)(Math.Min(readOnlySpan[i], value)); 3052value = (int)(Math.Min(readOnlySpan[(int)row], value));
Microsoft.DotNet.Build.Tasks.Feed (2)
src\common\GeneralUtils.cs (1)
71int minBytesAvailable = Math.Min(bytesLocalAvailable, bytesRemoteAvailable);
src\CreateAzureDevOpsFeed.cs (1)
214return project.Substring(0, Math.Min(3, project.Length));
Microsoft.DotNet.Build.Tasks.Feed.Tests (2)
PublishArtifactsInManifestTests.cs (2)
232int bytesToWrite = Math.Min(Math.Min(_streamBytes.Length - _position, count), maxStreamBytesThisCall);
Microsoft.DotNet.NuGetRepack.Tests (2)
TestHelpers\DiffUtil.cs (2)
263d[i, j] = Math.Min(Math.Min(m1, m2), m3);
Microsoft.DotNet.SignTool (2)
src\Hash.cs (1)
76var maxSize = Math.Min(maxItemsToHash, values.Length);
src\SignToolTask.cs (1)
402int min = Math.Min(dir1.Length, dir2.Length);
Microsoft.Extensions.AI.Evaluation.NLP (4)
Common\BLEUAlgorithm.cs (1)
98clippedCounts[h.Key] = Math.Min(h.Value, v);
Common\MatchCounter.cs (1)
68intersection._counts[kvp.Key] = Math.Min(kvp.Value, otherCount);
Common\NGramExtensions.cs (2)
35ReadOnlySpan<T> next = input.Slice(0, Math.Min(n, input.Length)); 42next = input.Slice(0, Math.Min(n, input.Length));
Microsoft.Extensions.DependencyInjection (2)
DependencyInjectionEventSource.cs (2)
123format.Substring(i * MaxChunkSize, Math.Min(MaxChunkSize, format.Length - i * MaxChunkSize)), i, chunkCount, 251descriptorString.Substring(i * MaxChunkSize, Math.Min(MaxChunkSize, descriptorString.Length - i * MaxChunkSize)), i, chunkCount);
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (2)
Linux\Resources\FileNamesOnlyFileSystem.cs (1)
49var min = Math.Min(length, c.Length);
Linux\Resources\HardcodedValueFileSystem.cs (1)
80var min = Math.Min(toRead.Length, length);
Microsoft.Extensions.Http.Diagnostics (1)
Logging\Internal\HttpRequestBodyReader.cs (1)
95var readLimit = Math.Min(readSizeLimit, (int)streamToReadFrom.Length);
Microsoft.Extensions.Http.Diagnostics.Tests (1)
Logging\AcceptanceTests.cs (1)
692var length = Math.Min(limit, responseString.Length);
Microsoft.Extensions.Identity.Core (1)
Base32.cs (1)
96var bits = Math.Min(5 - bitIndex, 8 - outputBits);
Microsoft.Extensions.ServiceDiscovery.Dns (2)
Resolver\DnsResolver.cs (2)
591records = new(Math.Min(count, 32)); 600ttl = Math.Min(ttl, record.Ttl);
Microsoft.Extensions.Telemetry (1)
Buffering\GlobalBuffer.cs (1)
138int currentBatchSize = Math.Min(MaxBatchSize, numItemsToEmit - offset);
Microsoft.Interop.SourceGeneration (2)
SyntaxExtensions.cs (1)
114(_, _) => Math.Min(idxPartial, idxRef)
TypeSymbolExtensions.cs (1)
278int numArgumentsToCopy = Math.Min(numArgumentsToInsert, typeArgumentsToSubstitute.Length - currentArityOffset);
Microsoft.Maui (1)
Extensions\IndicatorViewExtensions.cs (1)
15 var minValue = Math.Min(indicatorView.MaximumVisible, indicatorView.Count);
Microsoft.Maui.Controls (3)
MultiBinding.cs (1)
121 for (var i = 0; i < Math.Min(_bpProxies.Length, values.Length); i++)
Shapes\PathFigureCollectionConverter.cs (2)
498 currentIndex = Math.Min(currentIndex + 8, pathLength); // "Infinity" has 8 characters 508 currentIndex = Math.Min(currentIndex + 3, pathLength); // "NaN" has 3 characters
Microsoft.Maui.Graphics (8)
GradientPaint.cs (1)
127 var stopCount = Math.Min(colors.Length, offsets.Length);
Matrix3x2Extensions.cs (1)
150 count = Math.Min(dst.Length, count);
Text\AttributedTextExtensions.cs (3)
114 var paragraphLength = Math.Min(run.Length, length); 133 var paragraphLength = Math.Min(run.Length, end - paragraphStart); 143 var paragraphLength = Math.Min(run.Length, length - paragraphStart);
Text\AttributedTextRunExtensions.cs (3)
82 var length1 = Math.Min(first.Length, second.Length); 92 var length1 = Math.Min(first.Length, second.Length); 168 var length = Math.Min(run.Length, maxLength);
Microsoft.ML.AutoML (7)
ColumnInference\TextFileSample.cs (2)
133chunkCount = Math.Min(chunkCount, maxChunkCount); 253int sniffLim = Math.Min(1000, buffer.Length);
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)
90return _randomSweeper.ProposeSweeps(Math.Min(numOfCandidates, _args.NumberInitialPopulation - numRuns), previousRuns);
Utils\StringEditDistance.cs (2)
46rows[nextRow, j] = Math.Min(deletion, Math.Min(insertion, substitution));
Microsoft.ML.Core (13)
CommandLine\CmdParser.cs (1)
915endIndex = helpStrings.Help.LastIndexOf(' ', endIndex - 1, Math.Min(endIndex - index, charsPerLine));
Utilities\BigArray.cs (1)
267Array.Resize(ref _entries[0], Math.Min(BlockSize, Math.Max(2 * curLastBlockSize, newLastBlockLength)));
Utilities\MatrixTransposeOps.cs (8)
40int iend = Math.Min(m - i, _block); 43int jend = Math.Min(n - j, _block); 99int iend = Math.Min(m - i, _block); 100int jend = Math.Min(n - j, _block); 151int iend = Math.Min(m - i, _block); 152int jend = Math.Min(n - j, _block); 204int iend = Math.Min(m - i, _block); 205int jend = Math.Min(n - j, _block);
Utilities\Stream.cs (1)
703int numElementsToReadThisChunk = Math.Min(maxChunkSizeInElements, destination.Length);
Utilities\TextReaderStream.cs (2)
140int charCount = Math.Min(_line.Length - _lineCur, _charBlockSize); 160int toCopy = Math.Min(count - readCount, _buffLim - _buffCur);
Microsoft.ML.Core.Tests (2)
UnitTests\TestVBuffer.cs (2)
870min = rgen.Next(Math.Min(max + 10, len + 100) - max - 2) + max + 2; 871max = rgen.Next(Math.Min(min + 10, len + 100) - min) + min;
Microsoft.ML.Data (18)
Data\BufferBuilder.cs (4)
181Array.Resize(ref _values, Math.Max(Math.Min(_length, checked(_count * 2)), 8)); 183Array.Resize(ref _indices, Math.Max(Math.Min(_length, checked(_count * 2)), 8)); 209Array.Resize(ref _values, Math.Max(Math.Min(_length, checked(_count * 2)), 8)); 211Array.Resize(ref _indices, Math.Max(Math.Min(_length, checked(_count * 2)), 8));
Data\DataViewUtils.cs (1)
103return Math.Min(num, 2 * conc);
DataLoadSave\Binary\Codecs.cs (2)
212int sublen = Math.Min(byteLength, _buffer.Length); 272int sublen = Math.Min(byteLength, _buffer.Length);
DataLoadSave\Text\TextLoader.cs (1)
746inputSize = Math.Min(min, SrcLim - 1);
DataLoadSave\Text\TextLoaderParser.cs (1)
1175int ichEnd = Math.Min(ichLim, ichCur + 9);
DataView\CacheDataView.cs (1)
1105_currMax = Math.Min(_perm.Length - 1, _curr + _batchMask);
Deprecated\Instances\HeaderSchema.cs (1)
380int size = Math.Min(names.Length, count);
Evaluators\EvaluatorUtils.cs (1)
1401int numConfusionTableLabels = sample < 0 ? labelNames.Length : Math.Min(labelNames.Length, sample);
Evaluators\RankingEvaluator.cs (1)
1005int maxTrunc = Math.Min(truncationLevel, queryLabels.Count);
Prediction\Calibrator.cs (2)
1380_data = new DataItem[Math.Min(4, capacity)]; 1396Array.Sort(_data, 0, Math.Min(_itemsSeen, _capacity), comp);
Transforms\RowShufflingTransformer.cs (1)
659int circularSwapIndex = (_rand.Next(Math.Min(_liveCount, _poolRows)) + _circularIndex) % _pipeIndices.Length;
Utilities\SlotDropper.cs (2)
133var lim = Math.Min(SlotsMin[i], src.Length); 153var newCount = Math.Min(srcValues.Length, newLength);
Microsoft.ML.FastTree (20)
Dataset\Dataset.cs (1)
754int maxTrunc = Math.Min(trunc, boundaries[q + 1] - boundaries[q]);
GamClassification.cs (1)
127var toDoc = Math.Min(d + innerLoopSize, targets.Length);
Training\Applications\ObjectiveFunction.cs (1)
74GetGradientChunk(start, start + Math.Min(QueryThreadChunkSize, Dataset.NumQueries - start), GradSamplingRate, sampleIndex, threadIndex);
Training\DcgCalculator.cs (4)
122int maxTrunc = Math.Min(trunc, numDocuments); 379NdcgRangeWorkerChunkFromScores(dataset, labels, scores, result, start, Math.Min(dataset.NumQueries - start, chunkSize), threadIndex); 467Array.Sort(permutation, 0, Math.Min(count, _secondLevelcomparers[threadIndex].CompareFirstN), _secondLevelcomparers[threadIndex]); 518OrderingRangeWorkerFromScores(dataset, scores, result, start, Math.Min(dataset.NumQueries - start, chunkSize), threadIndex);
Training\DocumentPartitioning.cs (1)
76var toDoc = Math.Min(docStart + innerLoopSize, dataset.NumDocs);
Training\EnsembleCompression\LassoBasedEnsembleCompressor.cs (3)
66_numObservations = Math.Min(_trainSet.NumDocs, maxObservations); 110int selectedDocs = Math.Min(perLabelDocCount[curLabel], currentMax); 243int minimumNumberOfLambdas = Math.Min(MinNumberOFLambdas, numberOfLambdas);
Training\ScoreTracker.cs (1)
180var toDoc = Math.Min(d + innerLoopSize, Dataset.NumDocs);
Training\Test.cs (3)
546var endDoc = Math.Min(documentStart + chunkSize - 1, Dataset.NumDocs - 1); 624var endDoc = Math.Min(documentStart + chunkSize - 1, binaryLabels.Length - 1); 664var endDoc = Math.Min(documentStart + chunkSize - 1, Dataset.NumDocs - 1);
Training\WinLossCalculator.cs (1)
61WinLossRangeWorkerChunkFromScores(dataset, labels, scores, result, start, Math.Min(dataset.NumQueries - start, chunkSize), threadIndex));
TreeEnsemble\InternalRegressionTree.cs (3)
1387var toDoc = Math.Min(d + innerLoopSize, dataset.NumDocs); 1412var toDoc = Math.Min(d + innerLoopSize, dataset.NumDocs); 1435var toDoc = Math.Min(d + innerLoopSize, docIndices.Length);
TreeEnsemble\InternalTreeEnsemble.cs (1)
303var toDoc = Math.Min(d + innerLoopSize, dataset.NumDocs);
Microsoft.ML.KMeansClustering (1)
KMeansPlusPlusTrainer.cs (1)
282maxThreads = Math.Min(maxThreads, argNumThreads.Value);
Microsoft.ML.LightGbm (2)
LightGbmTrainerBase.cs (2)
1246ret = Math.Min(ret, 50); 1262ret = Math.Min(ret, numRow);
Microsoft.ML.Mkl.Components (1)
SymSgdClassificationTrainer.cs (1)
776int numPassesForThisBatch = Math.Min(numPassesForABatch, _options.NumberOfIterations - iter - numFinalPassesToTrainThoroughly);
Microsoft.ML.PCA (2)
PcaTrainer.cs (1)
218int oversampledRank = Math.Min(_rank + _oversampling, dimension);
PcaTransformer.cs (1)
310oversampledRank[iinfo] = Math.Min(transformInfos[iinfo].Rank + columns[iinfo].Oversampling, transformInfos[iinfo].Dimension);
Microsoft.ML.StandardTrainers (7)
Optimizer\DifferentiableFunction.cs (3)
198int numIters = Math.Min((int)x.Length, 10); 199int maxDirCount = Math.Min((int)x.Length / 2, 100); 203int dirCount = Math.Min(n * 10, maxDirCount);
Optimizer\LearningRateScheduler.cs (1)
258float calculatedStep = Math.Min(globalStep, decaySteps);
Standard\SdcaBinary.cs (1)
141=> Math.Min(8, Math.Max(1, Environment.ProcessorCount / 2));
Standard\SdcaRegression.cs (1)
171=> Math.Min(2, Math.Max(1, Environment.ProcessorCount / 2));
Standard\StochasticTrainerBase.cs (1)
48=> Math.Min(8, Math.Max(1, Environment.ProcessorCount / 2));
Microsoft.ML.Sweeper (6)
Algorithms\KdoSweeper.cs (1)
113var numSweeps = Math.Min(numOfCandidates, _args.NumberInitialPopulation - prevRuns.Length);
Algorithms\NelderMead.cs (4)
127int numSweeps = Math.Min(maxSweeps, _dim + 1 - _simplexVertices.Count); 149numSweeps = Math.Min(maxSweeps, _dim + 1 - _simplexVertices.Count); 401int numPoints = Math.Min(maxSweeps, _dim); 419int numPoints = Math.Min(maxSweeps, _pendingSweepsNotSubmitted.Count);
Algorithms\SmacSweeper.cs (1)
95return _randomSweeper.ProposeSweeps(Math.Min(numOfCandidates, _args.NumberInitialPopulation - numRuns), previousRuns);
Microsoft.ML.Sweeper.Tests (1)
TestSweeper.cs (1)
661Assert.Equal(Math.Min(args.NumberInitialPopulation, maxInitSweeps), sweeps.Length);
Microsoft.ML.TimeSeries (12)
AdaptiveSingularSpectrumSequenceModeler.cs (2)
664int evaluationLength = Math.Min(Math.Max(tMat.WindowSize, 200), k); 757int evaluationLength = Math.Min(Math.Max(tMat.WindowSize, 200), k);
PolynomialUtils.cs (2)
236b = Math.Min(uLen, i + 1) - 1; 362ind = Math.Min(factors.Count - 1, ind);
SrCnnEntireAnomalyDetector.cs (6)
613AverageFilter(_ifftMagList, Math.Min(_ifftMagList.Length, _judgementWindowSize)); 614for (int i = 0; i <= Math.Min(length, _minimumScoreWindowSize); ++i) 616_cumSumList[i] = _cumSumList[Math.Min(length, _minimumScoreWindowSize) - 1]; 906int end = Math.Min(data.Length - 1, idx + step); 921end = Math.Min(data.Length - 1, idx + step); 977int window = Math.Min(data.Length / 3, 512);
TrajectoryMatrix.cs (2)
522b = Math.Min(uLen, i + 1) - 1; 619int a = Math.Min(ue - us + 1, ve - vs + 1);
Microsoft.ML.Tokenizers (7)
Model\Word.cs (4)
209int count = Math.Min(SymbolsCount, maxTokens); 224int count = Math.Min(SymbolsCount, maxTokens); 239int count = Math.Min(SymbolsCount, maxTokens); 253int count = Math.Min(SymbolsCount, maxTokens);
Tokenizer.cs (1)
237tokenCount = Math.Min(maxTokenCount, tokens.Tokens.Count);
Utils\Helpers.cs (1)
61utf8Bytes = utf8Bytes.Slice(Math.Min(bytesLength, utf8Bytes.Length));
Utils\OrdinalUtf8StringComparer.cs (1)
29int minLength = Math.Min(x.Length, y.Length);
Microsoft.ML.Tokenizers.Data.Tests (1)
src\Common\tests\RetryHelper.cs (1)
15private static readonly Func<int, int> _defaultBackoffFunc = i => Math.Min(i * 100, 60_000);
Microsoft.ML.Tokenizers.Tests (3)
src\Common\tests\RetryHelper.cs (1)
15private static readonly Func<int, int> _defaultBackoffFunc = i => Math.Min(i * 100, 60_000);
src\Microsoft.ML.Tokenizers\Utils\Helpers.cs (1)
61utf8Bytes = utf8Bytes.Slice(Math.Min(bytesLength, utf8Bytes.Length));
src\Microsoft.ML.Tokenizers\Utils\OrdinalUtf8StringComparer.cs (1)
29int minLength = Math.Min(x.Length, y.Length);
Microsoft.ML.TorchSharp (1)
AutoFormerV2\AutoFormerV2Backbone.cs (1)
94outChannels: embedChannels[Math.Min(iLayer + 1, embedChannels.Count - 1)],
Microsoft.ML.Transforms (2)
Expression\BuiltinFunctions.cs (1)
281FunctionProviderUtils.Fn<I4, I4, I4>(Math.Min),
Expression\LambdaBinder.cs (1)
1415args[i] = Convert(node.Args.Items[i].AsExpr, best.Kinds[Math.Min(i, ivMax)]);
Microsoft.VisualBasic.Core (3)
Microsoft\VisualBasic\CompilerServices\VBBinder.vb (2)
1164For ParmIndex = 0 To Math.Min(LastArgIndexToCheck, ParamArrayIndex) - 1 1313For ParmIndex = 0 To Math.Min(ArgCountUpperBound, Math.Max(LastNonSetValueIndex0, LastNonSetValueIndex1))
Microsoft\VisualBasic\ErrObject.vb (1)
113ElseIf System.String.CompareOrdinal("Exception from HRESULT: 0x", 0, Msg, 0, Math.Min(Msg.Length, 26)) = 0 Then
Microsoft.VisualStudio.LanguageServices (6)
FindReferences\Entries\DocumentSpanEntry.cs (1)
237var lastLineNumber = Math.Min(sourceText.Lines.Count - 1, lineNumber + AdditionalLineCountPerSide);
MoveStaticMembers\TypeNameItem.cs (1)
54for (var i = 0; i < Math.Min(xnames.Length, ynames.Length); i++)
Packaging\PackageInstallerServiceFactory.cs (1)
641for (int i = 0, n = Math.Min(split1.Length, split2.Length); i < n; i++)
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceManager.cs (1)
263while ((read = source.Read(buffer, 0, Math.Min(left, buffer.Length))) != 0)
Venus\ContainedDocument.DocumentServiceProvider.cs (1)
309var endLine = line.Snapshot.GetLineFromLineNumber(Math.Min(line.Snapshot.LineCount - 1, line.LineNumber + AdditionalLineCountPerSide));
Workspace\VisualStudioDocumentNavigationService.cs (1)
343=> Math.Min(documentLength, Math.Max(position, 0));
MSBuildTaskHost (1)
Concurrent\ConcurrentQueue.cs (1)
112int nextSize = tail._preservedForObservation != 0 ? InitialSegmentLength : Math.Min(tail.Capacity * 2, MaxSegmentLength);
PresentationBuildTasks (3)
MS\Internal\MarkupCompiler\VersionHelper.cs (1)
204int build = Math.Min(ushort.MaxValue, (int)days.TotalDays);
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media\ParsersCommon.cs (2)
364_curIndex = Math.Min(_curIndex+8, _pathLength); // "Infinity" has 8 characters 374_curIndex = Math.Min(_curIndex+3, _pathLength); // "NaN" has 3 characters
PresentationCore (59)
MS\Internal\FontCache\FontCacheUtil.cs (1)
719int minLength = Math.Min(aLength, bLength);
MS\Internal\FontCache\FontFaceLayoutInfo.cs (1)
917int smaller = Math.Min(lastChar, firstChar);
MS\Internal\Generic\Span.cs (1)
505_cp = Math.Min(cp, _dcp);
MS\Internal\IListConverters.cs (4)
98List<double> list = new List<double>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1)); 141List<ushort> list = new List<ushort>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1)); 182List<bool> list = new List<bool>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1)); 224List<Point> list = new List<Point>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1));
MS\Internal\Ink\Renderer.cs (1)
559i = Math.Min(_visuals.Count, _strokes.Count); //not -1, we're about to decrement
MS\Internal\IO\Packaging\NetStream.cs (2)
145count = Math.Min(bytesAvailable, count); // don't return more than they requested, and don't return more than is available 729bytesAvailable = Math.Min(block.Length, (int)(data.End - block.Offset));
MS\Internal\Shaping\TypefaceMap.cs (4)
176cch = Math.Min(cch, itemSpanRider.Length); 177cch = Math.Min(cch, typefaceIndexSpanRider.Length); 221int cch = Math.Min(cchRange - ich, typefaceIndexSpanRider.Length); 387int cch = Math.Min(unicodeString.Length - ich, typefaceSpanRider.Length);
MS\Internal\TextFormatting\Bidi.cs (3)
1606((Math.Min(startOfNeutrals, startOfDelayed) == PositionInvalid) ? 1608(Math.Min(startOfNeutrals, startOfDelayed))); 1838cchText = Math.Min(cchText, index);
MS\Internal\TextFormatting\FormatSettings.cs (1)
173formatWidth = Math.Min(formatWidth, Constants.IdealInfiniteWidth);
MS\Internal\TextFormatting\FullTextLine.cs (5)
1370offsetToNextCaretStopIndex = Math.Min(Length, lsrun.Length - caretStopIndex + lsrun.OffsetToFirstCp + _cpFirst); 1412lscpVisisble = Math.Min(lscpVisisble, _metrics._lscpLim - 1); 1644int lscpEndInSubline = Math.Min( 1987int cch = Math.Min(plsrunSpanRider.Length, cchLeft); 2073cch = Math.Min(cch, cchLeft);
MS\Internal\TextFormatting\FullTextState.cs (1)
267return Math.Min(0, TextFormatterImp.RealToIdeal(_markerStore.Pap.TextMarkerProperties.Offset) - _store.Settings.TextIndent);
MS\Internal\TextFormatting\LexicalChunk.cs (2)
84return ich - cchLast + Math.Min(cchLast, lsdcp - lsdcpLast); 92return ich - cchLast + Math.Min(cchLast, lsdcp - lsdcpLast);
MS\Internal\TextFormatting\SimpleTextLine.cs (2)
838int afterLast = Math.Min(ich + run.Length, dcp + textLength) + _cpFirst; 1237cpVisible = Math.Min(cpRunEnd, cp);
MS\Internal\TextFormatting\TextMarkerSource.cs (1)
177Math.Min(_characterArray.Length, textSourceCharacterIndexLimit)
MS\Internal\TextFormatting\TextRunCacheImp.cs (2)
211int lookAheadLimit = Math.Min(runLength, looseCharLength + TextStore.TypicalCharactersPerLine); 237looseCharLength = Math.Min(runLength, endOffset);
MS\Internal\TextFormatting\TextStore.cs (6)
509int effectedRangeEnd = Math.Min(cpFetched - offset + runInfo.Length, bounds[bounds.Length - 1].Position); 519int currentRangeEnd = Math.Min(bounds[i].Position, effectedRangeEnd); 1121int runLength = Math.Min(span.length, cchToAdd - ichRun); 1209int first = limit - Math.Min(charRange.Length, limitCp - firstCp); 1292int spanLength = Math.Min(runInfoSpanRider.Length, textEffectsSpanRider.Length); 1293int ichEnd = Math.Min(ichRun + spanLength, cchUniform);
System\Windows\Media\ArcSegment.cs (1)
87count = Math.Min(count, 4);
System\Windows\Media\ByteStreamGeometryContext.cs (2)
478int cbDataForThisChunk = Math.Min(cbDataSize, 514int newChunkSize = Math.Min(2*_chunkList[_chunkList.Count-1].Length, c_maxChunkSize);
System\Windows\Media\FormattedText.cs (13)
324i = Math.Min(limit, i + formatRider.Length); 397i = Math.Min(limit, i + formatRider.Length); 451i = Math.Min(limit, i + formatRider.Length); 503i = Math.Min(limit, i + formatRider.Length); 561i = Math.Min(limit, i + formatRider.Length); 619i = Math.Min(limit, i + formatRider.Length); 669i = Math.Min(limit, i + formatRider.Length); 720i = Math.Min(limit, i + formatRider.Length); 771i = Math.Min(limit, i + formatRider.Length); 821i = Math.Min(limit, i + formatRider.Length); 960return _that._maxTextWidths[Math.Min(line, _that._maxTextWidths.Length - 1)]; 1102Math.Min(textSourcePosition + line.Length - 1, _that._text.Length - 1) 1614int x1 = Math.Min(enumerator.Position + enumerator.Length, startIndex + count);
System\Windows\Media\GlyphsSerializer.cs (1)
274lastCaretStop = Math.Min(i | 3, _caretStops.Count - 1);
System\Windows\Media\Imaging\BitmapPalette.cs (1)
268int numColors = Math.Min(256, _colors.Count);
System\Windows\Media\MediaContext.cs (1)
797_animationRenderRate = Math.Min(_animationRenderRate, 1000);
System\Windows\Media\ParsersCommon.cs (2)
364_curIndex = Math.Min(_curIndex+8, _pathLength); // "Infinity" has 8 characters 374_curIndex = Math.Min(_curIndex+3, _pathLength); // "NaN" has 3 characters
System\Windows\Media\VisualProxy.cs (1)
571Array.Copy(_tail, reallocatedTail, Math.Min(_tail.Length, newLength));
PresentationFramework (129)
MS\Internal\Data\RBTree.cs (1)
390int n = Math.Min(mid - left, right - mid);
MS\Internal\Documents\DocumentGrid.cs (2)
2223maxColumns = Math.Min(maxColumns, _pageCache.PageCount); 2224maxColumns = Math.Min(maxColumns, DocumentViewerConstants.MaximumMaxPagesAcross);
MS\Internal\Documents\IFlowDocumentViewer.cs (1)
826GoToPage(Math.Min(PageCount, MasterPageNumber + 2));
MS\Internal\Documents\RowCache.cs (1)
536_layoutColumns = Math.Min(_layoutColumns, PageCache.PageCount);
MS\Internal\Documents\TextBoxLine.cs (1)
113int runLength = Math.Min(128, position.GetTextRunLength(LogicalDirection.Backward));
MS\Internal\Documents\TextBoxView.cs (12)
646int startOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, startPosition.Offset); 647int endOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, endPosition.Offset); 655lastLineIndex = Math.Min(lastLineIndex, GetLineIndexFromOffset(endOffset, LogicalDirection.Backward)); 724int nextLineIndex = Math.Max(0, Math.Min(_lineMetrics.Count - 1, lineIndex + count)); 1889int endOffset = Math.Min(range.StartIndex + range.PositionsAdded, _host.TextContainer.SymbolCount); 2001int endOffset = Math.Min(_lineMetrics[lineIndex].EndOffset, unclippedEndOffset); 2097int endOffset = Math.Min(lineEndOffset, unclippedEndOffset); 2159firstLineIndex = Math.Max(0, Math.Min(firstLineIndex, _lineMetrics.Count - 1)); 2160lastLineIndex = Math.Max(0, Math.Min(lastLineIndex, _lineMetrics.Count - 1)); 2666int lineCount = Math.Min(oldLastLineIndex, firstLineIndex + count - 1) - lineIndex + 1; 2757count = Math.Min(count, _viewportLineVisuals.Count - start); 2933int rangeSize = Math.Min(viewportEnd, selectionEnd) - rangeStart;
MS\Internal\Documents\TextContainerHelper.cs (3)
198_cpFirst = Math.Min(_cpFirst, cpFirst); 223_ranges[i * 2] = Math.Min(_ranges[i * 2], cpFirst); 471int depth = Math.Min(ancestorsStart.Count, ancestorsEnd.Count);
MS\Internal\Documents\TextParagraphView.cs (2)
161lineIndex = Math.Min(lines.Count - 1, lineIndex); 571lineIndex = Math.Max(Math.Min((int)(point.Y / approximatedLineHeight), lines.Count - 1), 0);
MS\Internal\Globalization\LocalizableResourceBuilder.cs (2)
575Readability readability = (Readability)Math.Min( 581Modifiability modifiability = (Modifiability)Math.Min(
MS\Internal\PtsHost\ContainerParagraph.cs (5)
504fsrcToFillSubtrack.u = Math.Max(Math.Min(fsrcToFillSubtrack.u, fsrcToFill.u + fsrcToFill.du - 1), fsrcToFill.u); 518fsrcToFillSubtrack.v = Math.Max(Math.Min(fsrcToFillSubtrack.v, fsrcToFill.v + fsrcToFill.dv - 1), fsrcToFill.v); 579dvrUsed = Math.Min(fsrcToFill.dv, dvrUsed); 662urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack); 792urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
MS\Internal\PtsHost\DtrList.cs (2)
99int adjust = Math.Min(_dtrs[i].PositionsAdded, dtr.PositionsRemoved - delta); 113int adjust = Math.Min(dtr.PositionsRemoved, _dtrs[i].PositionsAdded - delta);
MS\Internal\PtsHost\FloaterParagraph.cs (2)
208dvrAvailable = Math.Min(dvrAvailable, PTS.dvBottomUndefined / 2); 214dvrAvailable = Math.Min(dvrAvailable, TextDpi.ToTextDpi(StructuralCache.CurrentFormatContext.PageHeight));
MS\Internal\PtsHost\MarginCollapsingState.cs (1)
164_minNegative = Math.Min(_minNegative, mcs._minNegative);
MS\Internal\PtsHost\PtsHelper.cs (1)
832return Math.Max(1, Math.Min(PTS.Restrictions.tscColumnRestriction-1, columns)); // at least 1 column is required
MS\Internal\PtsHost\PtsHost.cs (1)
1517for(int breakIndex = 0; breakIndex < Math.Min(textBreakpoints.Count, nLineVariantsAlloc); breakIndex++)
MS\Internal\PtsHost\TableParaClient.cs (3)
645int du = Math.Min(Math.Abs(rect.u - u), Math.Abs(rect.u + rect.du - u)); 646int dv = Math.Min(Math.Abs(rect.v - v), Math.Abs(rect.v + rect.dv - v)); 1927Math.Min(_calculatedColumns.Length, columns));
MS\Internal\PtsHost\TextParaClient.cs (8)
742int dcpEnd = Math.Min(cpEndTextPointer, cpParagraphEnd) - cpParagraphStart; 1407int countVisualsShiftBeforeChange = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual, 0), lineVisuals.Count); 1424int actualLinesToRemove = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual + cLinesToRemove, 0), lineVisuals.Count); 1452int actualLinesToRemove = Math.Min(cLinesToRemove, lineVisuals.Count - (lineIndexToBeginRemoval - _lineIndexFirstVisual)); 1875int cchRangeForThisLine = Math.Max(Math.Min(lineDesc.dcpLim, dcpEnd) - dcpRangeStartForThisLine, 1); 1985int cchRangeForThisElem = Math.Max(Math.Min(elemDesc.dcpLim, dcpEnd) - dcpRangeStartForThisElem, 1); 3126line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, lineDesc.dcpFirst), Math.Min(dcpEnd, lineDesc.dcpLim)); 3188line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, element.dcpFirst), Math.Min(dcpEnd, element.dcpLim));
MS\Internal\PtsHost\TextParagraph.cs (2)
809ddcpOld = Math.Min(ddcpOld, (LastFormatCch - dcpStart) + 1); 810ddcpNew = Math.Min(ddcpNew, (Cch - dcpStart) + 1);
MS\Internal\Text\ComplexLine.cs (1)
554offset = Math.Min(_dcp + this.Length, offset);
MS\Internal\Text\SimpleLine.cs (1)
80Math.Min(dcp, _content.Length)
System\Windows\Controls\DataGrid.cs (7)
2623indexToSelect = Math.Min(Items.Count - numSelected - 1, indexToSelect); 5044int previousStartIndex = Math.Min(startIndex, currentCellIndex); 5046int previousStartColumnIndex = Math.Min(startColumnIndex, currentCellColumnIndex); 5087_selectedCells.AddRegion(Math.Min(startIndex, endIndex), Math.Min(startColumnIndex, endColumnIndex), newRowCount, newColumnCount); 5951index = Math.Max(0, Math.Min(numItems - 1, index + (shiftModifier ? -1 : 1))); 6093targetIndex = Math.Max(0, Math.Min(targetIndex, Items.Count - 1));
System\Windows\Controls\DataGridColumnCollection.cs (2)
748int columnCount = Math.Min(newFrozenCount, Count); 756int columnCount = Math.Min(oldFrozenCount, Count);
System\Windows\Controls\Grid.cs (4)
953ColumnIndex = Math.Min(GetColumn(child), DefinitionsU.Length - 1), 956RowIndex = Math.Min(GetRow(child), DefinitionsV.Length - 1) 962cell.ColumnSpan = Math.Min(GetColumnSpan(child), DefinitionsU.Length - cell.ColumnIndex); 966cell.RowSpan = Math.Min(GetRowSpan(child), DefinitionsV.Length - cell.RowIndex);
System\Windows\Controls\ItemContainerGenerator.cs (1)
2756int index = Math.Min(oldIndex, newIndex);
System\Windows\Controls\PasswordTextNavigator.cs (2)
195finalCount = Math.Min(count, _container.SymbolCount - _offset); 199finalCount = Math.Min(count, _offset);
System\Windows\Controls\Primitives\DataGridCellsPresenter.cs (1)
128dirtyCount = Math.Min(newColumnCount, oldColumnCount);
System\Windows\Controls\PrintDialog.cs (1)
306Math.Min((int)dlg.MaxPage, _pageRange.PageTo));
System\Windows\Controls\Stack.cs (1)
990iNewOffset = Math.Max(Math.Min(numberOfItems - 1, iNewOffset), 0);
System\Windows\Controls\TextBlock.cs (1)
2310int dcpEnd = Math.Min(dcpLineEnd, dcpPositionEnd);
System\Windows\Controls\TextBox.cs (1)
1723if ( 2*(prefix + suffix) >= Math.Min(oldText.Length, newText.Length))
System\Windows\Controls\VirtualizedCellInfoCollection.cs (6)
610int right = Math.Min(Right, region.Right); 611int bottom = Math.Min(Bottom, region.Bottom); 681Left = Math.Min(Left, region.Left); 682Top = Math.Min(Top, region.Top); 725int bottom = Math.Min(Bottom, region.Bottom); 733int bottom = Math.Min(Bottom, region.Bottom);
System\Windows\Controls\VirtualizingStackPanel.cs (1)
9527return Math.Min(ItemCount, _firstItemInExtendedViewportIndex + _actualItemsInExtendedViewportCount);
System\Windows\Documents\Block.cs (2)
486double maxLineHeight = Math.Min(1000000, PTS.MaxFontSize); 530double maxThickness = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\Figure.cs (1)
297double maxOffset = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\FixedPageStructure.cs (1)
131line = Math.Max(0, Math.Min(line, _lineResults.Length - 1));
System\Windows\Documents\Floater.cs (1)
131double maxWidth = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\FlowDocument.cs (5)
1516double maxSize = Math.Min(1000000, PTS.MaxPageSize); 1531double maxSize = Math.Min(1000000, PTS.MaxPageSize); 1546double maxSize = Math.Min(1000000, PTS.MaxPageSize); 1567double maxRuleWidth = Math.Min(1000000, PTS.MaxPageSize); 1578double maxGap = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\FlowPosition.cs (1)
213maxLength = Math.Min(maxLength, remainingLength);
System\Windows\Documents\ImmComposition.cs (1)
1106_caretOffset = Math.Min(_caretOffset, text.Length);
System\Windows\Documents\List.cs (1)
326double maxOffset = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\Paragraph.cs (1)
302double maxIndent = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\Speller.cs (5)
994int timeOutOffset = Math.Min(data.TextMap.ContentEndOffset, sentenceEndOffset); 1181contextOffset = Math.Min(sTextRange.Start, contentOffset); 1186sTextRange = (SpellerInteropBase.ITextRange)segments[Math.Min(i, segments.Count-1)]; 1685runCount = Math.Min(runCount, _text.Length - _textLength); 1686runCount = Math.Min(runCount, position.GetOffsetToPosition(contextEnd));
System\Windows\Documents\Table.cs (1)
366double maxSpacing = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\TableColumn.cs (1)
196double maxPixel = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\TextContainerChangedEventArgs.cs (1)
401int cancelledCount = Math.Min(overlap, newChange.RemovedLength);
System\Windows\Documents\TextElement.cs (1)
1587double maxFontSize = Math.Min(1000000, PTS.MaxFontSize);
System\Windows\Documents\TextFindEngine.cs (3)
661runCount = Math.Min(runCount, findText.Length - findTextLength); 665runCount = Math.Min(runCount, navigator.GetOffsetToPosition(endPosition)); 675runCount = Math.Min(runCount, startPosition.GetOffsetToPosition(navigator));
System\Windows\Documents\TextPointer.cs (1)
1789finalCount += Math.Min(count - finalCount, textNode.SymbolCount - skipCount);
System\Windows\Documents\TextPointerBase.cs (5)
101maxCount = Math.Min(count, thisPointer.GetOffsetToPosition(limit)); 105maxCount = Math.Min(count, limit.GetOffsetToPosition(thisPointer)); 107maxCount = Math.Min(count, maxCount); 1423runLength = Math.Min(navigator.GetTextRunLength(LogicalDirection.Backward), SelectionWordBreaker.MinContextLength - preceedingCount); 1442runLength = Math.Min(navigator.GetTextRunLength(LogicalDirection.Forward), SelectionWordBreaker.MinContextLength - followingCount);
System\Windows\Documents\TextRangeEdit.cs (2)
2345new DoublePropertyRange (Paragraph.TextIndentProperty, -Math.Min(1000000, PTS.MaxPageSize), Math.Min(1000000, PTS.MaxPageSize))
System\Windows\Documents\TextRangeEditTables.cs (2)
332int firstRowIndex = Math.Min(anchorCell.Row.Index, movingCell.Row.Index); 334int firstColumnIndex = Math.Min(anchorCell.ColumnIndex, movingCell.ColumnIndex);
System\Windows\Documents\TextStore.cs (1)
2443runCount = TextPointerBase.GetTextWithLimit(navigator, LogicalDirection.Forward, text, charsCopied, Math.Min(cchReq, text.Length - charsCopied), limit);
System\Windows\Documents\TextTreeText.cs (4)
101firstCount = Math.Min(count, firstBlock.Count - firstBlockLocalOffset); 298count = Math.Min(rightBlock.FreeCapacity, length - textOffset); 340count = Math.Min(neighborBlock.FreeCapacity, textEndOffset - textOffset); 354count = Math.Min(rightBlock.FreeCapacity, textEndOffset - textOffset);
System\Windows\Documents\TextTreeTextBlock.cs (4)
93newText = new char[Math.Min(this.Count + count, MaxBlockSize)]; 108count = Math.Min(count, _gapSize); 247copyCount = Math.Min(count, _gapOffset - logicalOffset); 262copyCount = Math.Min(count, _text.Length - logicalOffset);
System\Windows\Documents\WinRTSpellerInteropExtensions.cs (1)
172int altFormsCount = Math.Min(missingFragmentText.Length, AlternateFormsMaximumCount);
System\Windows\FigureLength.cs (1)
99double maxPixel = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Standard\NativeMethods.cs (2)
2019Left = Math.Min(rect1.Left, rect2.Left), 2020Top = Math.Min(rect1.Top, rect2.Top),
ReachFramework (6)
MS\Internal\Printing\Configuration\COMPSTUISRID.cs (1)
39resString.Length = Math.Max(0, Math.Min(charCount, resString.Length));
MS\Internal\Printing\Configuration\DevMode.cs (1)
628int charsToWrite = Math.Min(value.Length, maxCharsToWrite - 1);
PrintConfig\FallbackPTProvider.cs (1)
155defaultCopies = Math.Max(minCopies, Math.Min(defaultDevMode.Copies, maxCopies));
PrintConfig\PrintSchemaShim.cs (1)
1178return (short)Math.Max(min, Math.Min(value, max));
PrintConfig\PTProvider.cs (2)
674int bytesToWrite = Math.Min(data.Length, (int)(byteCount - totalBytesWritten)); 728int bytesToRead = Math.Min(data.Length, (int)(byteCount - totalBytesRead));
Roslyn.Diagnostics.Analyzers (42)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
99rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Roslyn.Diagnostics.CSharp.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
706position = Math.Min(position, end - 1);
Roslyn.VisualStudio.Next.UnitTests (1)
Services\PerformanceTrackerServiceTests.cs (1)
157to = Math.Min(to, dataCount);
SignalRSamples (1)
Hubs\UploadHub.cs (1)
44return $"{winner} wins with a total of {Math.Max(p1score, p2score)} points to {Math.Min(p1score, p2score)}";
Sockets.FunctionalTests (3)
src\Servers\Kestrel\test\FunctionalTests\MaxRequestBufferSizeTests.cs (2)
143var size = Math.Min(data.Length - bytesWritten, maxSendSize); 236var size = Math.Min(data.Length - bytesWritten, maxSendSize);
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (1)
1128var received = await stream.ReadAsync(receiveBuffer, 0, Math.Min(receiveBuffer.Length, expectedBytes - totalReceived));
Stress.ApiService (1)
TraceCreator.cs (1)
111var activityLinkCount = Random.Shared.Next(0, Math.Min(5, _allActivities.Count));
Swaggatherer (1)
SwaggathererApplication.cs (1)
257var length = Math.Min(text.Length, Math.Max(5, part.Name.Length));
System.Collections (2)
System\Collections\Generic\PriorityQueue.cs (2)
805int childIndexUpperBound = Math.Min(i + Arity, size); 854int childIndexUpperBound = Math.Min(i + Arity, size);
System.Collections.Concurrent (1)
System\Collections\Concurrent\PartitionerStatic.cs (1)
451requestedChunkSize = Math.Min(_currentChunkSize.Value * 2, _maxChunkSize);
System.Collections.Immutable (2)
System\Collections\Frozen\FrozenHashTable.cs (1)
226Array.Clear(seenBuckets, 0, Math.Min(numBuckets, seenBuckets.Length));
System\Collections\Frozen\String\KeyAnalyzer.cs (1)
74int maxSubstringLength = Math.Min(minLength, MaxSubstringLengthLimit);
System.ComponentModel.TypeConverter (1)
System\ComponentModel\Container.cs (1)
228for (int i = 0; i < Math.Min(_siteCount, _sites!.Length); i++)
System.Data.Common (20)
System\Data\Common\AdapterUtil.Common.cs (1)
794startIndex = Math.Min(startIndex, index);
System\Data\Common\DbDataAdapter.cs (1)
987int maxBatchCommands = Math.Min(UpdateBatchSize, dataRows.Length);
System\Data\Common\Int32Storage.cs (1)
111min = Math.Min(_values[record], min);
System\Data\Common\ObjectStorage.cs (1)
310Array.Copy(_values, newValues, Math.Min(capacity, _values.Length));
System\Data\Common\StringStorage.cs (1)
185Array.Copy(_values, newValues, Math.Min(capacity, _values.Length));
System\Data\DataError.cs (1)
141int newCapacity = Math.Min(_count * 2, column.Table!.Columns.Count);
System\Data\DataTableReader.cs (2)
368int byteCount = Math.Min(tempBuffer.Length - srcIndex, length); 431int charCount = Math.Min(tempBuffer.Length - srcIndex, length);
System\Data\ProviderBase\SchemaMapping.cs (2)
299Debug.Assert(_mappedLength == Math.Min(_readerDataValues!.Length, _mappedDataValues!.Length), "incorrect precomputed length"); 1240_mappedLength = Math.Min(count, mappingCount);
System\Data\RecordManager.cs (1)
39Array.Copy(_rows, newRows, Math.Min(_lastFreeRecord, _rows.Length));
System\Data\SQLTypes\SQLBytes.cs (1)
326int count = Math.Min(buffer.Length, (int)(Length - offset));
System\Data\SQLTypes\SQLDecimal.cs (8)
1261ResPrec = Math.Min(MaxPrecision, ResPrec); 1465ResScale = Math.Min((ResPrec - ResInteger), ResScale); 1467ResScale = Math.Max(ResScale, Math.Min(ActualScale, s_cNumeDivScaleMin)); 1691MinScale = Math.Min(ResScale, s_cNumeDivScaleMin); 1693ResInteger = Math.Min(ResInteger, s_NUMERIC_MAX_PRECISION); 1700ResScale = Math.Min((ResPrec - ResInteger), ResScale); 2297bNewPrec = (byte)(Math.Min(s_NUMERIC_MAX_PRECISION, Math.Max(1, lAdjust + _bPrec))); 3168lPosition = Math.Min(s_NUMERIC_MAX_PRECISION, lPosition);
System.Data.Odbc (14)
System\Data\Odbc\OdbcConnection.cs (2)
399value = (BitConverter.IsLittleEndian ? Encoding.Unicode : Encoding.BigEndianUnicode).GetString(buffer, 0, Math.Min(cbActual, buffer.Length)); 501value = (BitConverter.IsLittleEndian ? Encoding.Unicode : Encoding.BigEndianUnicode).GetString(buffer, 0, Math.Min(cbActual, buffer.Length));
System\Data\Odbc\OdbcDataReader.cs (8)
571int nValues = Math.Min(values.Length, FieldCount); 972string strdata = buffer.PtrToStringUni(0, Math.Min(lengthOrIndicator, cbMaxData) / 2); 1013cbActual = Math.Min(lengthOrIndicator, cbMaxData); 1185int lengthOfCopy = Math.Min(lengthFromDataIndex, length); 1188lengthOfCopy = Math.Min(lengthOfCopy, buffer.Length - bufferIndex); 1308length = Math.Min(length, buffer.Length - bufferIndex); 1476Buffer.ReadBytes(0, rgBytes, cbOffset, Math.Min(cbActual, cbBufferLen)); 1489buffer.ReadBytes(0, rgBytes, cbOffset, Math.Min(cbActual, cbBufferLen));
System\Data\Odbc\OdbcParameter.cs (2)
322return Math.Min((int)_internalPrecision, ADP.DecimalMaxPrecision); 422return Math.Min((int)_internalPrecision, ADP.DecimalMaxPrecision);
System\Data\Odbc\OdbcUtils.cs (2)
39cb = Math.Min(cb / 2, (Length - 2) / 2); 47cb = Math.Min(cb, Length);
System.Diagnostics.DiagnosticSource (3)
System\Diagnostics\Metrics\CounterAggregator.cs (1)
21private readonly PaddedDouble[] _deltas = new PaddedDouble[Math.Min(Environment.ProcessorCount, 8)];
System\Diagnostics\Metrics\ExponentialHistogramAggregator.cs (1)
199return Math.Min(Math.Max(0, (int)(quantile * count)), count - 1);
System\Diagnostics\Metrics\RuntimeMetrics.cs (1)
21private static readonly int s_maxGenerations = Math.Min(GC.GetGCMemoryInfo().GenerationInfo.Length, s_genNames.Length);
System.Diagnostics.Process (1)
System\Diagnostics\ProcessWaitState.Unix.cs (1)
538pollingIntervalMs = Math.Min(pollingIntervalMs * 2, MaxPollingIntervalMs);
System.Drawing.Common.Tests (1)
System\Drawing\IconTests.cs (1)
117public override int Read(byte[] buffer, int offset, int count) => base.Read(buffer, offset, Math.Min(count, 1));
System.Drawing.Primitives (4)
System\Drawing\Rectangle.cs (4)
291int x2 = Math.Min(a.X + a.Width, b.X + b.Width); 293int y2 = Math.Min(a.Y + a.Height, b.Y + b.Height); 315int x1 = Math.Min(a.X, b.X); 317int y1 = Math.Min(a.Y, b.Y);
System.Formats.Asn1 (3)
System\Formats\Asn1\AsnDecoder.cs (1)
641int len = Math.Min(longestPermitted, source.Length);
System\Formats\Asn1\AsnWriter.Oid.cs (1)
173oidValue = oidValue.Slice(Math.Min(oidValue.Length, endIndex + 1));
System\Formats\Asn1\SetOfValueComparer.cs (1)
17int min = Math.Min(x.Length, y.Length);
System.Formats.Nrbf (3)
System\Formats\Nrbf\ArraySinglePrimitiveRecord.cs (2)
134int sliceSize = Math.Min(valuesToRead.Length, MaxChunkLength); 256List<T> values = new List<T>(Math.Min(count, 4));
System\Formats\Nrbf\RectangularArrayRecord.cs (1)
30_records = new List<SerializationRecord>(Math.Min(4, arrayInfo.GetSZArrayLength()));
System.Formats.Tar (2)
System\Formats\Tar\TarHeader.Write.cs (2)
1062int numToCopy = Math.Min(bytesToWrite.Length, destination.Length); 1079int numToCopy = Math.Min(bytesToWrite.Length, destination.Length - 1);
System.IO.Compression (3)
System\IO\Compression\DeflateManaged\InputBuffer.cs (1)
149int length = Math.Min(output.Length, _buffer.Length);
System\IO\Compression\DeflateManaged\OutputWindow.cs (2)
88length = Math.Min(Math.Min(length, WindowSize - _bytesUsed), input.AvailableBytes);
System.IO.Pipelines (4)
System\IO\Pipelines\Pipe.cs (2)
264int adjustedToMaximumSize = Math.Min(maxBufferSize, sizeHint); 1104int writable = Math.Min(destination.Length, source.Length);
System\IO\Pipelines\StreamPipeReader.cs (1)
539int adjustedToMaximumSize = Math.Min(maxBufferSize, sizeHint);
System\IO\Pipelines\StreamPipeWriter.cs (1)
180var adjustedToMaximumSize = Math.Min(maxBufferSize, sizeHint);
System.IO.Ports (3)
System\IO\Ports\SerialPort.cs (3)
675bytesReadToBuffer = Math.Min(CachedBytesToRead, count); 891int bytesToRead = Math.Min(count, CachedBytesToRead); 923currentBytesToExamine = Math.Min(count - totalCharsFound, _readLen - _readPos - totalBytesExamined);
System.Linq (13)
System\Linq\Chunk.cs (2)
66TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 82int arraySize = Math.Min(size, 4);
System\Linq\SegmentedArrayBuilder.cs (1)
145ReadOnlySpan<T> sourceSlice = sourceSpan.Slice(0, Math.Min(availableSpaceInCurrentSpan, sourceSpan.Length));
System\Linq\Select.SpeedOpt.cs (2)
932return _selector(_source[Math.Min(lastIndex, _maxIndexInclusive)]); 949return Math.Min(count - 1, _maxIndexInclusive) - _minIndexInclusive + 1;
System\Linq\Shuffle.SpeedOpt.cs (4)
154TryGetNonEnumeratedCount(_source, out int count) ? Math.Min(_takeCount, count) : 170if ((uint)index < (uint)Math.Min(_takeCount, iteratorCount)) 178if ((uint)index < (uint)Math.Min(_takeCount, count)) 239reservoir = new List<TSource>(Math.Min(takeCount, 4)) { e.Current };
System\Linq\SkipTake.SpeedOpt.cs (2)
97return _source[Math.Min(lastIndex, _maxIndexInclusive)]; 113return Math.Min(sourceCount - 1, maxIndexInclusive) - minIndexInclusive + 1;
System\Linq\Take.cs (2)
144Debug.Assert(queue.Count == Math.Min(count, startIndex)); 196Math.Min(count, isEndIndexFromEnd ? count - endIndex : endIndex);
System.Linq.AsyncEnumerable (3)
System\Linq\Chunk.cs (1)
50int arraySize = Math.Min(size, 4);
System\Linq\Take.cs (2)
173Debug.Assert(queue.Count == Math.Min(count, startIndex)); 226Math.Min(count, isEndIndexFromEnd ? count - endIndex : endIndex);
System.Linq.Expressions (1)
System\Runtime\CompilerServices\RuleCache.cs (1)
47int max = Math.Min(_rules.Length, i + count);
System.Linq.Parallel (4)
System\Linq\Parallel\QueryOperators\Binary\ZipQueryOperator.cs (1)
184_count = Math.Min(_leftChildResults.Count, _rightChildResults.Count);
System\Linq\Parallel\QueryOperators\Unary\TakeOrSkipQueryOperator.cs (1)
377return Math.Min(_childCount, _takeOrSkipOp._count);
System\Linq\Parallel\Scheduling\Scheduling.cs (1)
34internal static readonly int DefaultDegreeOfParallelism = Math.Min(Environment.ProcessorCount, MAX_SUPPORTED_DOP);
System\Linq\Parallel\Utils\Sorting.cs (1)
384_sharedBarriers[phase][Math.Min(_partitionIndex, partnerIndex)].SignalAndWait(cancelToken);
System.Memory (2)
System\Buffers\BuffersExtensions.cs (1)
137int writeSize = Math.Min(destination.Length, input.Length);
System\Buffers\SequenceReader.cs (1)
444int toCopy = Math.Min(nextSpan.Length, destination.Length - copied);
System.Memory.Data (1)
System\BinaryData.cs (1)
287bufferSize = longLength == 0 ? 1 : Math.Min((int)longLength, CopyToBufferSize);
System.Net.Http (24)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\DynamicTable.cs (2)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity); 84int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackDecoder.cs (4)
425int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 463int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackDecoder.cs (2)
287int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 373int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex);
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (1)
140byteCount = Math.Min(byteCount, limit - ActiveMemory.Length);
System\Net\Http\Headers\AltSvcHeaderParser.cs (1)
140maxAge = Math.Min(maxAge.GetValueOrDefault(), maxAgeTmp);
System\Net\Http\HttpContent.cs (2)
940: Math.Min(_expectedFinalSize, MaxInitialBufferSize / LastResizeFactor); 949newBufferCapacity = Math.Min(newBufferCapacity, remainingUntilMaxCapacity);
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (1)
367int bytesToConsume = Math.Min(maxBytesToRead, (int)Math.Min((ulong)connectionBuffer.Length, _chunkBytesRemaining));
System\Net\Http\SocketsHttpHandler\ContentLengthReadStream.cs (1)
184int bytesToConsume = Math.Min(maxBytesToRead, (int)Math.Min((ulong)connectionBuffer.Length, _contentBytesRemaining));
System\Net\Http\SocketsHttpHandler\CreditManager.cs (2)
106int granted = Math.Min(waiter.Amount, _current); 169int granted = Math.Min(amount, _current);
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (2)
444string response = Encoding.ASCII.GetString(_incomingBuffer.ActiveSpan.Slice(0, Math.Min(20, _incomingBuffer.ActiveLength))); 1718int frameSize = Math.Min(remaining.Length, FrameHeader.MaxPayloadLength);
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (3)
484int granted = Math.Min(_availableCredit, _creditWaiter.Amount); 1116int bytesRead = Math.Min(buffer.Length, activeBuffer.Length); 1285sendSize = Math.Min(buffer.Length, _availableCredit);
System\Net\Http\SocketsHttpHandler\Http2StreamWindowManager.cs (1)
114int extendedWindowSize = Math.Min(MaxStreamWindowSize, _streamWindowSize * 2);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (1)
77_headerDecoder = new QPackDecoder(maxHeadersLength: (int)Math.Min(int.MaxValue, _headerBudgetRemaining));
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (1)
1749int toCopy = Math.Min(available.Length, buffer.Length);
System.Net.HttpListener (5)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
35Log.DumpBuffer(IdOf(thisOrContextObject), memberName, buffer.Slice(0, Math.Min(buffer.Length, MaxDumpSize)).ToArray());
System\Net\Managed\ChunkedInputStream.cs (1)
142ares._count = Math.Min(8192, _decoder.ChunkLeft + 6);
System\Net\Managed\HttpRequestStream.Managed.cs (2)
76int size = Math.Min(_length, count); 82size = Math.Min(size, _buffer.Length - _offset);
System\Net\Managed\HttpResponseStream.Managed.cs (1)
184int new_count = Math.Min(size, 16384 - (int)ms.Position + (int)start);
System.Net.Mail (3)
System\Net\BufferedReadStream.cs (2)
36int read = Math.Min(buffer.Length, _storedLength - _storedOffset); 58int read = Math.Min(buffer.Length, _storedLength - _storedOffset);
System\Net\Mail\SmtpReplyReaderFactory.cs (1)
292int left = Math.Min(4 - statusRead, actual);
System.Net.NameResolution (1)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
181buffer[0] = (byte)Math.Min(buffer.Length, 255);
System.Net.Ping (1)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
181buffer[0] = (byte)Math.Min(buffer.Length, 255);
System.Net.Primitives (4)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
181buffer[0] = (byte)Math.Min(buffer.Length, 255);
System\Net\CookieContainer.cs (3)
385int min_count = Math.Min((int)(domain_count * remainingFraction), Math.Min(m_maxCookiesPerDomain, m_maxCookies) - 1); 956int length = Math.Min(ll, lr);
System.Net.Quic (5)
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (1)
140byteCount = Math.Min(byteCount, limit - ActiveMemory.Length);
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
181buffer[0] = (byte)Math.Min(buffer.Length, 255);
src\libraries\Common\src\System\Net\StreamBuffer.cs (2)
112int bytesWritten = Math.Min(buffer.Length, _buffer.AvailableMemory.Length); 205int bytesRead = Math.Min(buffer.Length, _buffer.ActiveMemory.Length);
System\Net\Quic\Internal\ReceiveBuffers.cs (1)
77copied = Math.Min(buffer.Length, activeBuffer.Length);
System.Net.Security (6)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
35Log.DumpBuffer(IdOf(thisOrContextObject), memberName, buffer.Slice(0, Math.Min(buffer.Length, MaxDumpSize)).ToArray());
System\Net\Security\NegotiateStream.cs (3)
354int copyBytes = Math.Min(_readBufferCount, buffer.Length); 430int copyBytes = Math.Min(_readBufferCount, buffer.Length); 520int chunkBytes = Math.Min(buffer.Length, MaxWriteDataSize);
System\Net\Security\SslStream.IO.cs (2)
617int chunkBytes = Math.Min(buffer.Length, MaxDataSize); 1001int copyBytes = Math.Min(_buffer.DecryptedLength, buffer.Length);
System.Net.Sockets (2)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
35Log.DumpBuffer(IdOf(thisOrContextObject), memberName, buffer.Slice(0, Math.Min(buffer.Length, MaxDumpSize)).ToArray());
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
181buffer[0] = (byte)Math.Min(buffer.Length, 255);
System.Net.WebClient (1)
src\libraries\Common\src\System\IO\ChunkedMemoryStream.cs (1)
50int toCopy = Math.Min(remaining, buffer.Length);
System.Net.WebSockets (2)
System\Net\WebSockets\ManagedWebSocket.cs (1)
916int receiveBufferBytesToCopy = Math.Min(limit, _receiveBufferCount);
System\Net\WebSockets\ManagedWebSocket.KeepAlive.cs (1)
135internal int HeartBeatIntervalMs => Math.Max(Math.Min(DelayMs, TimeoutMs) / 4, MinIntervalMs);
System.Private.CoreLib (95)
src\libraries\Common\src\System\Collections\Concurrent\SingleProducerSingleConsumerQueue.cs (1)
111int newSegmentSize = Math.Min(_tail._array.Length * 2, MaxSegmentSize);
src\libraries\Common\src\System\Number.Formatting.Common.cs (1)
843int zeroes = Math.Min(-digPos, nMaxDigits);
src\libraries\Common\src\System\Number.Parsing.Common.cs (1)
227numberOfTrailingZeros = Math.Min(numberOfTrailingZeros, numberOfFractionalDigits);
src\libraries\System.Private.CoreLib\src\System\Array.cs (1)
66(uint)Math.Min(newSize, larray.Length));
src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (1)
508return Math.Min(partitionCount, Environment.ProcessorCount);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Helper\Base64DecoderHelper.cs (1)
569int BlockSize = Math.Min(source.Length - (int)sourceIndex, 4);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Number.cs (2)
113int numNonLeadingDigitsBeforeDecimalToCopy = Math.Min(numNonLeadingDigitsBeforeDecimal, maxDigitCount); 177int numDigitsAfterDecimalToCopy = Math.Min(srcIndex - startIndexOfDigitsAfterDecimalToCopy, maxDigitCount - dstIndex);
src\libraries\System.Private.CoreLib\src\System\Collections\Concurrent\ConcurrentQueue.cs (1)
645int nextSize = tail._preservedForObservation ? InitialSegmentLength : Math.Min(tail.Capacity * 2, MaxSegmentLength);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Queue.cs (1)
112int firstPart = Math.Min(_array.Length - _head, numToCopy);
src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (3)
1967curScale = Math.Min(9, -scale); 2058curScale = Math.Min(9, -scale); 2120curScale = Math.Min(9, -scale);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\CounterGroup.cs (1)
303sleepDurationInMilliseconds = Math.Min(sleepDurationInMilliseconds, millisecondsTillNextPoll);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (3)
2088int paramCount = Math.Min(eventTypes.typeInfos.Length, args.Length); // parameter count mismatch get logged in LogEventArgsMismatches 2149args = new object?[Math.Min(eventDataCount, metadata.Parameters.Length)]; 2950dataDescrs[1].Size = (uint)Math.Min(dataLeft, chunkSize);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\XplatEventLogger.cs (1)
90eventDataCount = Math.Min(payloadName.Count, payload.Count);
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (4)
350int length = Math.Min(source.Length, prefix.Length); 432int length = Math.Min(source.Length, prefix.Length); 534int length = Math.Min(source.Length, suffix.Length); 617int length = Math.Min(source.Length, suffix.Length);
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.Icu.cs (1)
87int length = Math.Min(WINDOWS_MAX_COLLATION_NAME_LENGTH, endOfCollation - collationIndex); // Windows doesn't allow collation names longer than 8 characters
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (5)
464FormatDigits(ref result, hour12, Math.Min(tokenLen, 2)); 469FormatDigits(ref result, dateTime.Hour, Math.Min(tokenLen, 2)); 474FormatDigits(ref result, dateTime.Minute, Math.Min(tokenLen, 2)); 479FormatDigits(ref result, dateTime.Second, Math.Min(tokenLen, 2)); 638FormatDigits(ref result, year, Math.Min(tokenLen, 2));
src\libraries\System.Private.CoreLib\src\System\Globalization\InvariantModeCasing.cs (1)
185int length = Math.Min(lengthA, lengthB);
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.cs (1)
18int length = Math.Min(lengthA, lengthB);
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.Utf8.cs (4)
23int length = Math.Min(lengthA, lengthB); 176int length = Math.Min(lengthA, lengthB); 336int length = Math.Min(sourceLength, prefixLength); 486int length = Math.Min(sourceLength, prefixLength);
src\libraries\System.Private.CoreLib\src\System\Globalization\OrdinalCasing.Icu.cs (1)
191int length = Math.Min(lengthA, lengthB);
src\libraries\System.Private.CoreLib\src\System\Int32.cs (1)
692public static int Min(int x, int y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\IO\BinaryReader.cs (2)
265int readLength = Math.Min(MaxCharBytesSize, stringLength - currPos); 286sb ??= StringBuilderCache.Acquire(Math.Min(stringLength, StringBuilderCache.MaxBuilderSize)); // Actual string length in chars may be smaller.
src\libraries\System.Private.CoreLib\src\System\IO\BufferedStream.cs (4)
124byte[] shadowBuffer = new byte[Math.Min(_bufferSize + _bufferSize, MaxShadowBufferSize)]; 448int readbytes = Math.Min(_readLen - _readPos, destination.Length); 768int bytesToWrite = Math.Min(_bufferSize - _writePos, count); 783int bytesToWrite = Math.Min(_bufferSize - _writePos, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (4)
1523int bytesNeeded = checked(preambleSize + encoding.GetMaxByteCount(Math.Min(contents.Length, ChunkSize))); 1541ReadOnlySpan<char> toEncode = contents.Slice(0, Math.Min(contents.Length, ChunkSize)); 1579byte[] bytes = ArrayPool<byte>.Shared.Rent(preambleSize + encoding.GetMaxByteCount(Math.Min(contents.Length, ChunkSize))); 1595ReadOnlyMemory<char> toEncode = contents.Slice(0, Math.Min(contents.Length, ChunkSize));
src\libraries\System.Private.CoreLib\src\System\IO\MemoryStream.cs (1)
357int n = Math.Min(_length - _position, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (3)
373int n = Math.Min(_readLen - _readPos, destination.Length); 407bytesFromBuffer = Math.Min(buffer.Length, _readLen - _readPos); 447bytesFromBuffer = Math.Min(_readLen, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (1)
552int len = Math.Min(_byteLen, preamble.Length);
src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (2)
438int n = Math.Min(charBuffer.Length - dstPos, count); 789int n = Math.Min(_charLen - _charPos, source.Length - copied);
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (1)
3532int minLength = Math.Min(span.Length, other.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\RabinKarp.cs (1)
47minimumLength = Math.Min(minimumLength, value.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\StringSearchValues.cs (1)
459minLength = Math.Min(minLength, value.Length);
src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (9)
87int length = Math.Min(strA.Length, strB.Length); 323lengthA = Math.Min(lengthA, strA.Length - indexA); 328lengthB = Math.Min(lengthB, strB.Length - indexB); 358lengthA = Math.Min(lengthA, strA.Length - indexA); 363lengthB = Math.Min(lengthB, strB.Length - indexB); 403int lengthA = Math.Min(length, strA.Length - indexA); 404int lengthB = Math.Min(length, strB.Length - indexB); 484int lengthA = Math.Min(length, strA.Length - indexA); 485int lengthB = Math.Min(length, strB.Length - indexB);
src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (4)
375int bytesWritten = (int)Ascii.NarrowUtf16ToAscii(pChars, pBytes, (uint)Math.Min(charsLength, bytesLength)); 393int numElementsToConvert = Math.Min(chars.Length, bytes.Length); 666bytesConsumed = (int)Ascii.WidenAsciiToUtf16(pBytes, pChars, (uint)Math.Min(charsLength, bytesLength)); 681int numElementsToConvert = Math.Min(bytes.Length, chars.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (2)
321int bytesWritten = (int)Latin1Utility.NarrowUtf16ToLatin1(pChars, pBytes, (uint)Math.Min(charsLength, bytesLength)); 621int charsWritten = Math.Min(bytesLength, charsLength);
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (11)
159capacity = Math.Min(DefaultCapacity, maxCapacity); 207persistedCapacity = Math.Min(Math.Max(DefaultCapacity, persistedString.Length), persistedMaxCapacity); 417int capacityToPreserve = Math.Min(Capacity, Math.Max(Length * 6 / 5, m_ChunkChars.Length)); 845int length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count); 909chunkEndIndex = Math.Min(chunkEndIndex, chunk.m_ChunkLength); 2109ReadOnlySpan<char> remainingChunk = chunk.m_ChunkChars.AsSpan(indexInChunk, Math.Min(chunk.m_ChunkLength - indexInChunk, count)); 2145Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk), 2232int endInChunk = Math.Min(chunk.m_ChunkLength, endIndexInChunk); 2476int lengthToCopy = Math.Min(lengthInChunk, count); 2562int newBlockLength = Math.Max(minBlockCharCount, Math.Min(Length, MaxChunkSize)); 2674int copyCount1 = Math.Min(count, indexInChunk);
src\libraries\System.Private.CoreLib\src\System\Text\TranscodingStream.cs (2)
353int bytesToReturn = Math.Min(_readBufferCount, buffer.Length); 432int bytesToReturn = Math.Min(_readBufferCount, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Transcoding.cs (2)
32nuint numElementsConverted = Ascii.WidenAsciiToUtf16(pInputBuffer, pOutputBuffer, (uint)Math.Min(inputLength, outputCharsRemaining)); 853nuint numElementsConverted = Ascii.NarrowUtf16ToAscii(pInputBuffer, pOutputBuffer, (uint)Math.Min(inputLength, outputBytesRemaining));
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.cs (2)
274_legacy_maxIOCompletionThreads = (short)Math.Min(ioCompletionThreads, MaxPossibleThreadCount); 276short newMaxThreads = (short)Math.Min(workerThreads, MaxPossibleThreadCount);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.HillClimbing.cs (2)
321newThreadWaveMagnitude = Math.Min(newThreadWaveMagnitude, _maxThreadWaveMagnitude); 343newThreadCount = Math.Min(maxThreads, newThreadCount);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.WaitThread.cs (1)
234timeoutDurationMs = Math.Min(handleTimeoutDurationMs, timeoutDurationMs);
src\libraries\System.Private.CoreLib\src\System\Threading\ProcessorIdCache.cs (1)
143s_processorIdRefreshRate = Math.Min((int)(minID * 5 / minTLS), MaxIdRefreshRate);
src\libraries\System.Private.CoreLib\src\System\Threading\SemaphoreSlim.cs (1)
812int waitersToNotify = Math.Min(currentCount, waitCount) - m_countOfWaitersPulsedToWake;
src\libraries\System.Private.CoreLib\src\System\Threading\WaitHandle.cs (1)
223Math.Min(MaxWaitHandles, 2 * currentLength))];
src\System\StubHelpers.cs (1)
452int numChars = Math.Min(managed.Length, length - 1);
System.Private.DataContractSerialization (36)
System\Runtime\Serialization\Json\JsonEncodingStreamWrapper.cs (1)
266int size = Math.Min(_chars.Length, buffer.Length);
System\Runtime\Serialization\Json\XmlJsonReader.cs (1)
755actual = Math.Min(count, value.Length);
System\Runtime\Serialization\XmlReaderDelegator.cs (1)
793return Math.Min(context.RemainingItemCount, dictionaryReader.Quotas.MaxArrayLength);
System\Xml\ArrayHelper.cs (1)
69count = Math.Min(count, 256);
System\Xml\EncodingStreamWrapper.cs (2)
312int max = offset + Math.Min(count, BufferLength); 470int inputCount = Math.Min(count, BufferLength * 2);
System\Xml\ValueHandle.cs (4)
663actual = Math.Min(_length, count); 673int charCount = Math.Min(count / 3 * 4, _length); 742actualByteCount = Math.Min(charCount, byteCount); 807int charCount = Math.Min(count, _length / sizeof(char));
System\Xml\XmlBaseReader.cs (6)
1148actual = Math.Min(count, value.Length); 1178return ReadBytes(DataContractSerializer.Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), false); 1370return ReadBytes(DataContractSerializer.Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), true); 1390return ReadBytes(DataContractSerializer.BinHexEncoding, 1, 2, buffer, offset, Math.Min(count, 512), true); 1425int actual = Math.Min(_trailByteCount, byteCount); 1493int actual = Math.Min(_trailByteCount, byteCount);
System\Xml\XmlBinaryReader.cs (10)
1240int actual = Math.Min(count, _arrayCount); 1263int actual = Math.Min(count, _arrayCount); 1286int actual = Math.Min(count, _arrayCount); 1309int actual = Math.Min(count, _arrayCount); 1332int actual = Math.Min(count, _arrayCount); 1355int actual = Math.Min(count, _arrayCount); 1378int actual = Math.Min(count, _arrayCount); 1402int actual = Math.Min(count, _arrayCount); 1431int actual = Math.Min(count, _arrayCount); 1467int actual = Math.Min(count, _arrayCount);
System\Xml\XmlBinaryReaderSession.cs (1)
47XmlDictionaryString[] newStrings = new XmlDictionaryString[Math.Min(Math.Max(id + 1, _strings.Length * 2), MaxArrayEntries)];
System\Xml\XmlBufferReader.cs (5)
163TryEnsureBytes(Math.Min(count, _windowOffsetMax - offset)); 230newOffsetMax = Math.Min(newOffsetMax, newBuffer.Length); 872int length = Math.Min(byteLength, charLength); 886int length = Math.Min(byteLength, charLength); 918int length = Math.Min(length1, length2);
System\Xml\XmlCanonicalWriter.cs (1)
832int length = Math.Min(length1, length2);
System\Xml\XmlSigningNodeWriter.cs (1)
360int byteCount = Math.Min(_base64Chars.Length / 4 * 3, count - count % 3);
System\Xml\XmlUTF8TextWriter.cs (2)
654int byteCount = Math.Min(bufferLength / 4 * 3, count - count % 3); 673int byteCount = Math.Min(bufferLength / 4 * 3, count - count % 3);
System.Private.Windows.Core (4)
System\Collections\Generic\ArrayBuilder.cs (2)
30_items = new T[Math.Min(expectedCount, MaxInitialArrayLength)]; 61int newCapacity = Math.Min(_maxCount, 2 * _items.Length);
System\IO\Compression\RunLengthEncoder.cs (1)
68if (!writer.TryWrite((byte)Math.Min(count, 0xFF)) || !writer.TryWrite(value))
System\Text\ValueStringBuilder.cs (1)
30Math.Min(MinimumArrayPoolLength, literalLength + (GuessedLengthPerHole * formattedCount)));
System.Private.Xml (9)
System\Xml\Core\XmlReader.cs (1)
1712int bytesToRead = Math.Min(bytes.Length, 2);
System\Xml\Core\XmlTextReaderImpl.cs (1)
2885int bytesToRead = Math.Min(4, _ps.bytes.Length - _ps.bytesUsed);
System\Xml\Core\XmlTextReaderImplAsync.cs (1)
913int bytesToRead = Math.Min(4, _ps.bytes.Length - _ps.bytesUsed);
System\Xml\Core\XmlTextWriter.cs (1)
1450_textWriter.Write(_indentChars, 0, Math.Min(i, _indentChars.Length));
System\Xml\Schema\BitSet.cs (1)
219int i = Math.Min(_bits.Length, other._bits.Length);
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (2)
1297for (int j = 0; j < Math.Min(pLength, mapping.Members.Length); j++) 1328for (int j = 0; j < Math.Min(pLength, mapping.Members.Length); j++)
System\Xml\Serialization\XmlSerializationReader.cs (2)
482currentSize = Math.Min(currentSize * 2, MAX_ALLOC_SIZE); 503currentSize = Math.Min(block.Length, total);
System.Reflection.Emit (1)
System\Reflection\Emit\ILGeneratorImpl.cs (1)
49internal int GetMaxStack() => Math.Min(ushort.MaxValue, _maxStackDepth + _depthAdjustment);
System.Reflection.Metadata (11)
System\Reflection\Internal\Utilities\MemoryBlock.cs (1)
67displayedBytes = Math.Min(Length, 64);
System\Reflection\Metadata\BlobBuilder.cs (5)
236int minLength = Math.Min(left.Length - leftStart, right.Length - rightStart); 287int bytesToCopy = Math.Min(bufferEnd, chunkEnd) - bufferStart; 634int bytesToCurrent = Math.Min(FreeBytes, byteCount); 674int bytesToCurrent = Math.Min(FreeBytes, buffer.Length); 712int bytesToCurrent = Math.Min(FreeBytes, byteCount);
System\Reflection\Metadata\Ecma335\Encoding\ControlFlowBuilder.cs (2)
30internal int OperandSize => Math.Min(_instructionEndDisplacement, 4); 303int chunkSize = Math.Min(branch.OperandOffset - srcOffset, srcBlob.Length - srcBlobOffset);
System\Reflection\PortableExecutable\PEBuilder.cs (2)
446length = Math.Min(remainingHeaderToSign, blobLength); 452length = Math.Min(remainingHeader, blobLength);
System\Reflection\PortableExecutable\PEReader.cs (1)
414int size = Math.Min(
System.Runtime.Caching (5)
System\Runtime\Caching\CacheExpires.cs (1)
391newLength = Math.Min(newLength, oldLength + MAX_PAGES_INCREMENT);
System\Runtime\Caching\CacheMemoryMonitor.cs (1)
215percent = Math.Min(100, (int)((cacheSize - _memoryLimit) * 100L / cacheSize));
System\Runtime\Caching\CacheUsage.cs (1)
376newLength = Math.Min(newLength, oldLength + MAX_PAGES_INCREMENT);
System\Runtime\Caching\MemoryCacheStatistics.cs (1)
82int newPollingInterval = Math.Min(_configPollingInterval, MEMORYSTATUS_INTERVAL_30_SECONDS);
System\Runtime\Caching\PhysicalMemoryMonitor.cs (1)
89percent = Math.Min(50, (int)((lastTrimPercent * TargetTotalMemoryTrimIntervalTicks) / ticksSinceTrim));
System.Runtime.Numerics (5)
src\libraries\Common\src\System\Number.Formatting.Common.cs (1)
843int zeroes = Math.Min(-digPos, nMaxDigits);
src\libraries\Common\src\System\Number.Parsing.Common.cs (1)
227numberOfTrailingZeros = Math.Min(numberOfTrailingZeros, numberOfFractionalDigits);
System\Number.BigInteger.cs (2)
326ReadOnlySpan<byte> intDigits = number.Digits.Slice(0, Math.Min(number.Scale, number.DigitsCount)); 381int totalDigitCount = Math.Min(number.DigitsCount, number.Scale);
System\Numerics\BigIntegerCalculator.DivRem.cs (1)
571int quotientLength = Math.Min(left.Length - right.Length + 1, quotient.Length);
System.Runtime.Serialization.Schema (1)
System\Runtime\Serialization\Schema\CodeExporter.cs (1)
1545length = Math.Min(MaxIdentifierLength, length);
System.Security.Cryptography (9)
src\libraries\Common\src\System\Security\Cryptography\ECDiffieHellmanDerivation.cs (1)
223int len = Math.Min(p.Length, retSpan.Length);
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Builder.cs (1)
198salt = stackalloc byte[Math.Min(macKey.Length, 128)];
src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (1)
288Span<byte> nullTerminator = destination.Slice(0, Math.Min(2, destination.Length));
System\Security\Cryptography\CryptoStream.cs (1)
315int bytesToCopy = Math.Min(_outputBufferIndex, buffer.Length);
System\Security\Cryptography\PKCS1MaskGenerationMethod.cs (1)
49Buffer.BlockCopy(hash, 0, rgbT, ib, Math.Min(rgbT.Length - ib, hash.Length));
System\Security\Cryptography\RandomNumberGenerator.cs (2)
319Span<byte> remainingRandom = randomBuffer.Slice(0, Math.Min(RandomBufferSize, needed)); 339remainingRandom = randomBuffer.Slice(0, Math.Min(RandomBufferSize, needed));
System\Security\Cryptography\X509Certificates\CertificatePolicy.cs (1)
222restriction = Math.Min(restriction, policyRestriction.Value);
System\Security\Cryptography\XmlKeyHelper.cs (1)
144int localLength = Math.Min(ByteLimit, length);
System.Security.Cryptography.Pkcs (2)
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Builder.cs (1)
198salt = stackalloc byte[Math.Min(macKey.Length, 128)];
src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (1)
288Span<byte> nullTerminator = destination.Slice(0, Math.Min(2, destination.Length));
System.ServiceModel.NetFramingBase (11)
System\ServiceModel\Channels\Connection.cs (1)
72int bytesToCopy = Math.Min(buffer.Length, _preReadData.Length);
System\ServiceModel\Channels\FramingChannels.cs (2)
382Math.Min(FaultStringDecoder.FaultSizeQuota, connection.ConnectionBufferSize)), 408Math.Min(FaultStringDecoder.FaultSizeQuota, connection.ConnectionBufferSize)),
System\ServiceModel\Channels\SingletonConnectionReader.cs (8)
351int bytesToCopy = Math.Min(_chunkBytesRemaining, 352Math.Min(_chunkBufferSize, count)); 377bytesToRead = Math.Min(count, _chunkBytesRemaining + IntEncoder.MaxEncodedSize); 383DecodeData(buffer, offset, Math.Min(bytesRead, _chunkBytesRemaining)); 455int bytesToCopy = Math.Min(_chunkBytesRemaining, 456Math.Min(_chunkBufferSize, count)); 481bytesToRead = Math.Min(count, _chunkBytesRemaining + IntEncoder.MaxEncodedSize); 487DecodeData(buffer, offset, Math.Min(bytesRead, _chunkBytesRemaining));
System.ServiceModel.Syndication (1)
System\ServiceModel\XmlBuffer.cs (1)
48int initialBufferSize = Math.Min(512, maxBufferSize);
System.Text.Json (6)
System\Text\Json\JsonHelpers.Date.cs (1)
308int fractionEnd = Math.Min(sourceIndex + JsonConstants.DateTimeParseNumFractionDigits, source.Length);
System\Text\Json\Reader\Utf8JsonReader.MultiSegment.cs (3)
588int amountToWrite = Math.Min(span.Length, readSoFar.Length - written); 622return Math.Min( 624Math.Min(span.Length, (int)bytePositionInLine + 1));
System\Text\Json\Serialization\Metadata\JsonTypeInfo.Cache.cs (1)
97int iForward = Math.Min(propertyIndex, count);
System\Text\Json\ThrowHelper.cs (1)
534int printFirst10 = Math.Min(value.Length, 10);
System.Text.RegularExpressions (17)
System\Text\RegularExpressions\RegexCompiler.cs (1)
849int setsToUse = Math.Min(sets.Count, MaxSets);
System\Text\RegularExpressions\RegexInterpreter.cs (4)
946int len = Math.Min(Operand(1), Forwardchars()); 970int len = Math.Min(Operand(1), Forwardchars()); 1013int len = Math.Min(Operand(1), Forwardchars()); 1056int c = Math.Min(Operand(1), Forwardchars());
System\Text\RegularExpressions\RegexNode.cs (4)
1283int minLength = Math.Min(startingSpan.Length, startingNode.Str.Length); 2301min = Math.Min(min, Child(i).ComputeMinLength()); 2308return Math.Min(Child(0).ComputeMinLength(), Child(1).ComputeMinLength()); 2312return Math.Min(Child(1).ComputeMinLength(), Child(2).ComputeMinLength());
System\Text\RegularExpressions\RegexParser.cs (1)
1436int c = Math.Min(3, _pattern.Length - _pos);
System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (7)
114int reps = node.Kind is RegexNodeKind.One ? 1 : Math.Min(node.M, MaxPrefixLength); 164int reps = node.Kind is RegexNodeKind.Set ? 1 : Math.Min(node.M, MaxPrefixLength); 228int limit = Math.Min(node.M, MaxPrefixLength); // MaxPrefixLength here is somewhat arbitrary, as a single loop iteration could yield multiple chars 434int count = Math.Min(node.M, SingleCharIterationLimit); 442int limit = Math.Min(node.M, NodeIterationLimit); 612int minIterations = Math.Min(node.M, MaxLoopExpansion); 643int minIterations = Math.Min(node.M, MaxLoopExpansion);
System.Text.RegularExpressions.Generator (14)
RegexGenerator.Emitter.cs (1)
1143int setsToUse = Math.Min(sets.Count, MaxSets);
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexNode.cs (4)
1283int minLength = Math.Min(startingSpan.Length, startingNode.Str.Length); 2301min = Math.Min(min, Child(i).ComputeMinLength()); 2308return Math.Min(Child(0).ComputeMinLength(), Child(1).ComputeMinLength()); 2312return Math.Min(Child(1).ComputeMinLength(), Child(2).ComputeMinLength());
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexParser.cs (1)
1436int c = Math.Min(3, _pattern.Length - _pos);
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (7)
114int reps = node.Kind is RegexNodeKind.One ? 1 : Math.Min(node.M, MaxPrefixLength); 164int reps = node.Kind is RegexNodeKind.Set ? 1 : Math.Min(node.M, MaxPrefixLength); 228int limit = Math.Min(node.M, MaxPrefixLength); // MaxPrefixLength here is somewhat arbitrary, as a single loop iteration could yield multiple chars 434int count = Math.Min(node.M, SingleCharIterationLimit); 442int limit = Math.Min(node.M, NodeIterationLimit); 612int minIterations = Math.Min(node.M, MaxLoopExpansion); 643int minIterations = Math.Min(node.M, MaxLoopExpansion);
Stubs.cs (1)
48int length = Math.Min(span.Length, other.Length);
System.Threading (2)
System\Threading\Barrier.cs (2)
874int waitTime = totalTimeout == Timeout.Infinite ? maxWait : Math.Min(maxWait, totalTimeout); 888maxWait = maxWait >= waitTimeCeiling ? waitTimeCeiling : Math.Min(maxWait << 1, waitTimeCeiling);
System.Threading.Channels (1)
src\libraries\Common\src\System\Collections\Concurrent\SingleProducerSingleConsumerQueue.cs (1)
111int newSegmentSize = Math.Min(_tail._array.Length * 2, MaxSegmentSize);
System.Threading.Tasks.Dataflow (1)
src\libraries\Common\src\System\Collections\Concurrent\SingleProducerSingleConsumerQueue.cs (1)
111int newSegmentSize = Math.Min(_tail._array.Length * 2, MaxSegmentSize);
System.Threading.Tasks.Parallel (1)
System\Threading\Tasks\Parallel.cs (1)
116rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
System.Windows.Controls.Ribbon (12)
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGalleryItemsPanel.cs (12)
362columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount); 374columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount); 381columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / arrangeWidth), childrenCount)), maxColumnCount); 390columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount); 397columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / _arrangeWidth), childrenCount)), maxColumnCount); 404columnCount = Math.Max(minColumnCount, Math.Min(childrenCount, maxColumnCount)); 566finalColumnCount = Math.Max(minColumnCount, Math.Min((int)(finalSize.Width / arrangeWidth), maxColumnCount));
System.Windows.Forms (141)
System\Windows\Forms\Accessibility\LabelEditUiaTextProvider.cs (2)
289clientLocation.X = Math.Min(clientLocation.X, clientRectangle.right); 291clientLocation.Y = Math.Min(clientLocation.Y, clientRectangle.bottom);
System\Windows\Forms\Application.cs (1)
1015i = Math.Min(i, s_forms.Count); // Form can be removed from the collection, we need to check it
System\Windows\Forms\Control.cs (2)
4989int width = Math.Min(Width, targetBounds.Width); 4990int height = Math.Min(Height, targetBounds.Height);
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (2)
331size = Math.Min(size, Math.Min(bounds.Width, bounds.Height));
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.LayoutOptions.cs (8)
578int textBottom = Math.Min(layout.TextBounds.Bottom, layout.Field.Bottom); 580Math.Min(layout.TextBounds.Y, layout.Field.Y + (layout.Field.Height - layout.TextBounds.Height) / 2), 588int textRight = Math.Min(layout.TextBounds.Right, layout.Field.Right); 590Math.Min(layout.TextBounds.X, layout.Field.X + (layout.Field.Width - layout.TextBounds.Width) / 2), 600Math.Min(maxBounds.Width - layout.TextBounds.Width, layout.ImageBounds.Width)); 609Math.Min(maxBounds.Height - layout.TextBounds.Height, layout.ImageBounds.Height)); 645bottom = Math.Min(layout.TextBounds.Bottom, maxBounds.Bottom); 652bottom = Math.Min(layout.TextBounds.Bottom, layout.Field.Bottom);
System\Windows\Forms\Controls\ComboBox\ComboBox.ComboBoxUiaTextProvider.cs (2)
362clientLocation.X = Math.Min(clientLocation.X, clientRectangle.right); 364clientLocation.Y = Math.Min(clientLocation.Y, clientRectangle.bottom);
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (2)
2200return actualLength == PInvoke.LB_ERR ? string.Empty : buffer[..Math.Min(maxLength, actualLength)].ToString(); 3358int count = Math.Min(Math.Max(itemCount, 1), _maxDropDownItems);
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (1)
618int lo = Math.Min(e.OldIndex, e.NewIndex);
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (19)
1125int widthLoss = Math.Min(stepDownAvailableWidthForFillColumns - availableWidth, Math.Max(1, (int)(stepDownAvailableWidthForFillColumns * 0.1F))); 1158mostDeservingDataGridViewColumn.DesiredFillWidth = Math.Min(oldDesiredWidth, (int)Math.Round(floatDesiredWidth, MidpointRounding.AwayFromZero)); 2466cursorClip.Width = Math.Min(frozenWidth, _layout.Data.Width); 2480cursorClip.Width = Math.Min(scrollingWidth, _layout.Data.Width); 2984r.X = Math.Min(r.X, inside.Right - r.Width); 2993r.X = Math.Min(inside.Right - r.Width, r.X); 3014r.X = Math.Min(inside.Right - 3, r.X); 3029r.Y = Math.Min(inside.Bottom - 3, r.Y); 4388colHeaders.Height = Math.Min(_columnHeadersHeight, colHeaders.Height); 4402rowHeaders.Width = Math.Min(RowHeadersWidth, rowHeaders.Width); 4421topLeft.Width = Math.Min(RowHeadersWidth, topLeft.Width); 5665: Math.Min( 6049int y = Math.Min(e.Y + _mouseBarOffset, _layout.Data.Bottom - 1); 6118newX = Math.Min(x + _mouseBarOffset, _layout.Data.Right - 1); 6301x = Math.Min(e.X + _mouseBarOffset, _layout.Data.Right - 1); 6328int y = Math.Min(e.Y + _mouseBarOffset, _layout.Data.Bottom - 1); 8996int preferredWidth = Math.Min(minimumWidth + Columns.GetColumnsWidth(DataGridViewElementStates.Visible), proposedConstraints.Width); 9013int preferredHeight = Math.Min(minimumHeight + Rows.GetRowsHeight(DataGridViewElementStates.Visible), proposedConstraints.Height); 17706rowIndex = Math.Min(rowIndex, Rows.Count - 1);
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxCell.cs (5)
543dropHeight = Math.Min(GetDropDownButtonHeight(screen, cellStyle), adjustedSize.Height - 2); 546int dropWidth = Math.Min(SystemInformation.HorizontalScrollBarThumbWidth, adjustedSize.Width - 2 * Margin - 1); 1989int dropWidth = Math.Min(SystemInformation.HorizontalScrollBarThumbWidth, valBounds.Width - 2 * Margin - 1); 1996dropHeight = Math.Min(GetDropDownButtonHeight(g, cellStyle), paintPostXPThemes ? valBounds.Height : valBounds.Height - 2); 2000dropHeight = Math.Min(GetDropDownButtonHeight(g, cellStyle), valBounds.Height - 4);
System\Windows\Forms\Controls\DataGridView\DataGridViewImageCell.cs (4)
435preferredSize = new Size(0, Math.Min(img.Height, decimal.ToInt32((decimal)img.Height * imgWidthAllowed / img.Width))); 447preferredSize = new Size(0, Math.Min(ico.Height, decimal.ToInt32((decimal)ico.Height * icoWidthAllowed / ico.Width))); 470preferredSize = new Size(Math.Min(img.Width, decimal.ToInt32((decimal)img.Width * imgHeightAllowed / img.Height)), 0); 482preferredSize = new Size(Math.Min(ico.Width, decimal.ToInt32((decimal)ico.Width * icoHeightAllowed / ico.Height)), 0);
System\Windows\Forms\Controls\GroupBox\GroupBox.cs (1)
541int textRight = Math.Min(textLeft + textSize.Width, Width - 6);
System\Windows\Forms\Controls\Labels\LinkLabel.cs (2)
637int length = Math.Min(link.Length, textLen - link.Start); 1681int minEnd = Math.Min(left.Start + left.Length, right.Start + right.Length);
System\Windows\Forms\Controls\Labels\LinkUtilities.cs (1)
44int nMax = Math.Min(rgb.Length, rgbsCount);
System\Windows\Forms\Controls\ListBoxes\ListBox.cs (1)
1578return actualLength == PInvoke.LB_ERR ? string.Empty : buffer[..Math.Min(maxLength, actualLength)].ToString();
System\Windows\Forms\Controls\ListView\ColumnHeader.cs (1)
131int lowDI = Math.Min(DisplayIndexInternal, value);
System\Windows\Forms\Controls\ListView\ListView.cs (4)
1898topIndex = Math.Min(topIndex, VirtualListSize - 1); 4141cColumns = (uint)(_columnHeaders is not null ? Math.Min(MAXTILECOLUMNS, _columnHeaders.Length) : 0), 6283int lowDI = Math.Min(from, to); 6902Marshal.Copy(charBuf, 0, destPtr, Math.Min(charBuf.Length, infoTip->cchTextMax));
System\Windows\Forms\Controls\ListView\ListViewGroup.ListViewGroupAccessibleObject.cs (2)
66groupRect.bottom = Math.Min(listViewBounds.Bottom, groupRect.bottom); 68groupRect.right = Math.Min(listViewBounds.Right, groupRect.right);
System\Windows\Forms\Controls\ListView\ListViewItem.IKeyboardToolTip.cs (2)
114new Size(Math.Min(TextRenderer.MeasureText(item.Text, item.Font).Width, itemBounds.Width), 131return new Rectangle(point, new Size(Math.Min(textWidth, itemBounds.Width), itemBounds.Height));
System\Windows\Forms\Controls\ListView\ListViewItem.ListViewItemTileAccessibleObject.cs (1)
109int subItemCount = Math.Min(_owningListView.Columns.Count, _owningItem.SubItems.Count);
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.cs (4)
1954y = Math.Min((rectTarget.Y + rectTarget.Height - 15), y); 2692height = Math.Min(helpRequestedHeight, maxSpace); 2702height = Math.Min(helpRequestedHeight, maxSpace / 2 - 1); 2732height = Math.Min(commandsRequestedHeight, maxSpace);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\GridEntry.cs (1)
1570int maxSpace = Math.Min(rect.Width - stringX - 1, labelWidth + PropertyGridView.GdiPlusSpace);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\HelpPane.cs (1)
160Math.Min(_lineHeight, size.Height),
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (8)
1423location.X = Math.Min( 2101int pos = Math.Max(Math.Min(xPosition, widthPS - 10), OutlineIconSize * 2); 3191newOffset = Math.Min(newOffset, TotalProperties - _visibleRows + 1); 3224newOffset = Math.Min(newOffset, TotalProperties - _visibleRows + 1); 3298int visibleCount = Math.Min(TotalProperties - GetScrollOffset(), 1 + _visibleRows); 3314visibleCount = Math.Min(visibleCount, endRow + 1); 3739DropDownListBox.Height = Math.Max(tm.tmHeight + 2, Math.Min(_maxListBoxHeight, DropDownListBox.PreferredHeight)); 4558int newPosition = Math.Max(0, Math.Min(TotalProperties - _visibleRows + 1, offset));
System\Windows\Forms\Controls\RichTextBox\RichTextBox.cs (1)
2036txrg.chrg.cpMax = Math.Min(txrg.chrg.cpMax, end);
System\Windows\Forms\Controls\Splitter\Splitter.cs (1)
799return Math.Max(Math.Min(size, _maxSize), _minSize);
System\Windows\Forms\Controls\TextBox\TextBoxBase.TextBoxBaseUiaTextProvider.cs (2)
127clientLocation.X = Math.Min(clientLocation.X, clientRectangle.right); 129clientLocation.Y = Math.Min(clientLocation.Y, clientRectangle.bottom);
System\Windows\Forms\Controls\ToolStrips\StatusStrip.cs (1)
210scaledGripHeight = Math.Min(scaledGripHeight, clientRect.Height);
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDownMenu.cs (1)
839minY = Math.Min(minY, item.Bounds.Top);
System\Windows\Forms\Controls\ToolStrips\ToolStripManager.cs (3)
1214int insertIndex = Math.Min(destinationItems.Count, source.MergeIndex); 1320historyItem.PreviousIndexCollection!.Insert(Math.Min(historyItem.PreviousIndex, historyItem.PreviousIndexCollection.Count), historyItem.TargetItem!); 1323historyItem.IndexCollection!.Insert(Math.Min(historyItem.Index, historyItem.IndexCollection.Count), historyItem.TargetItem!);
System\Windows\Forms\Controls\ToolStrips\ToolStripOverflowButton.cs (2)
78preferredSize.Width = Math.Min(constrainingSize.Width, s_maxSize); 82preferredSize.Height = Math.Min(constrainingSize.Height, s_maxSize);
System\Windows\Forms\Controls\ToolStrips\ToolStripSplitButton.cs (1)
301Rectangle dropDownButtonBounds = new(Point.Empty, new Size(Math.Min(Width, DropDownButtonWidth), Height));
System\Windows\Forms\Controls\TrackBar\TrackBar.cs (1)
959Value = Math.Min(absScrollBands + Value, Maximum);
System\Windows\Forms\DataBinding\Command.cs (1)
76icmdLim = Math.Min(IdLim - IdMin, 2 * icmd);
System\Windows\Forms\DataBinding\CurrencyManager.cs (3)
372listposition = Math.Min(newPosition, Count - 1); 690ChangeRecordState(Math.Min(listposition, _list.Count - 1), true, false, true, false); 742ChangeRecordState(Math.Min(listposition, Count - 1), true, false, true, false);
System\Windows\Forms\Dialogs\CommonDialogs\ColorDialog.cs (1)
87MemoryMarshal.Cast<int, COLORREF>(value)[..Math.Min(customColors.Length, value.Length)].CopyTo(customColors);
System\Windows\Forms\Dialogs\TaskDialog\TaskDialog.cs (1)
1100_buttonClickNavigationCounter.navigationIndex = Math.Min(
System\Windows\Forms\Dialogs\ThreadExceptionDialog.cs (1)
265_scaledMessageTopPadding + (_scaledMaxTextHeight - Math.Min(textSize.Height, _scaledMaxTextHeight)) / 2,
System\Windows\Forms\Form.cs (2)
1240Size = new Size(Math.Min(size.Width, value.Width), Math.Min(size.Height, value.Height));
System\Windows\Forms\Internal\WinFormsUtils.cs (2)
82bounds.Size = new Size(Math.Min(constrainingBounds.Width - 2, bounds.Width), 83Math.Min(constrainingBounds.Height - 2, bounds.Height));
System\Windows\Forms\Layout\CommonProperties.cs (2)
207bounds.Width = Math.Min(bounds.Width, value.Width); 208bounds.Height = Math.Min(bounds.Height, value.Height);
System\Windows\Forms\Layout\Containers\SplitContainer.cs (4)
1092x = Math.Max(Math.Min(x, Width - Panel2MinSize), Panel1MinSize); 1097y = Math.Max(Math.Min(y, Height - Panel2MinSize), Panel1MinSize); 1523return Math.Max(Math.Min(size, Width - Panel2MinSize), Panel1MinSize); 1527return Math.Max(Math.Min(size, Height - Panel2MinSize), Panel1MinSize);
System\Windows\Forms\Layout\LayoutUtils.cs (2)
215Math.Min(a.Width, b.Width), 216Math.Min(a.Height, b.Height));
System\Windows\Forms\Layout\TableLayout.cs (15)
168containerInfo.ColumnStyles[0].SetSize(Math.Max(oldWidth, Math.Min(proposedConstraints.Width, containerSize.Width))); 371rowStop = Math.Min(currentRow + flowElement.RowSpan, maxRows); 391fixedElement!.RowStart = Math.Min(fixedElement.RowPosition, maxRows - 1); 392fixedElement.ColumnStart = Math.Min(fixedElement.ColumnPosition, maxColumns - 1); 436colStop = Math.Min(fixedElement.ColumnStart + fixedElement.ColumnSpan, maxColumns); 437rowStop = Math.Min(fixedElement.RowStart + fixedElement.RowSpan, maxRows); 591colStop = Math.Min(layoutInfo.ColumnSpan, maxColumns); 741int colStop = Math.Min(layoutInfo.ColumnStart + layoutInfo.ColumnSpan, containerInfo.Columns.Length); 780int stealAmount = Math.Min(currentOverflow, totalPercentAllocatedSpace); 858int rowStop = Math.Min(layoutInfo.RowStart + layoutInfo.RowSpan, containerInfo.Rows.Length); 874for (int i = start; i < Math.Min(start + span, strips.Length); i++) 957int offset = Math.Min(sizeProxy.Size, missingLength); 1157int delta = Math.Min(strip.MaxSize - strip.MinSize, remainingSpace); 1272elementBounds.Width = Math.Min(cellBounds.Width, elementBounds.Width); 1273elementBounds.Height = Math.Min(cellBounds.Height, elementBounds.Height);
System\Windows\Forms\Printing\PrintPreviewControl.cs (1)
211value = Math.Min(value, _pageInfo.Length - (_rows * _columns));
System\Windows\Forms\Rendering\ControlPaint.cs (2)
1896int minDim = Math.Min(width, height); 1916int size = Math.Min(width, height);
System\Windows\Forms\Rendering\ControlPaint.HLSColor.cs (2)
39int min = Math.Min(Math.Min(r, g), b);
System\Windows\Forms\Scrolling\ScrollableControl.cs (4)
615pos = Math.Min(pos, maxPos); 631pos = Math.Min(pos, maxPos); 749int minX = Math.Min(client.Width - displayRectangle.Width, 0); 750int minY = Math.Min(client.Height - displayRectangle.Height, 0);
System\Windows\Forms\Scrolling\ScrollBar.cs (4)
211return Math.Min(_largeChange, _maximum - _minimum + 1); 299return Math.Min(_smallChange, LargeChange); 682newValue = Math.Min(_value + SmallChange, _maximum - LargeChange + 1); 690newValue = Math.Min(_value + LargeChange, _maximum - LargeChange + 1);
System\Windows\Forms\Scrolling\ScrollProperties.cs (2)
81return Math.Min(_largeChange, _maximum - _minimum + 1); 191return Math.Min(_smallChange, LargeChange);
System\Windows\Forms\ToolTip\ToolTip.cs (2)
2088? Math.Min(currentTooltipSize.Width - 2 * BalloonOffsetX, screen.WorkingArea.Width) 2089: Math.Min(currentTooltipSize.Width, screen.WorkingArea.Width);
System.Windows.Forms.Design (37)
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.cs (3)
105listBox.Height = Math.Max(tm.tmHeight + 2, Math.Min(ListBoxMaximumHeight, listBox.PreferredHeight)); 347editorLocation.X = Math.Min(rectScreen.Right - dropDownSize.Width, // min = right screen edge clip 371editorLocation.X = Math.Min(rectScreen.Right - dropDownSize.Width, // min = right screen edge clip
System\ComponentModel\Design\MultilineStringEditor.MultilineStringEditorUI.cs (2)
172int requestedDelta = Math.Min((requestedSize.Width - ClientSize.Width), maxDelta); 242Math.Min(Font.Height * 10, workingArea.Height / 3));
System\ComponentModel\Design\SelectionService.cs (1)
262_contextKeyword = (short)Math.Min(count, s_selectionKeywords.Length - 1);
System\Windows\Forms\Design\Behavior\DragAssistanceManager.cs (6)
828coord += (Math.Min(dragRect.Bottom, lines[i].OriginalBounds.Bottom) - coord) / 2; 832lines[i].X1 = Math.Min(dragRect.Right, lines[i].OriginalBounds.Right); 852coord += (Math.Min(dragRect.Right, lines[i].OriginalBounds.Right) - coord) / 2; 856lines[i].Y1 = Math.Min(dragRect.Bottom, lines[i].OriginalBounds.Bottom); 944line = new Line(snapLine.Offset, Math.Min(dragBounds.Top + (_snapPointY != INVALID_VALUE ? _snapPointY : 0), bounds.Top), 954line = new Line(Math.Min(dragBounds.Left + (_snapPointX != INVALID_VALUE ? _snapPointX : 0), bounds.Left), snapLine.Offset,
System\Windows\Forms\Design\Behavior\DragAssistanceManager.Line.cs (6)
53new(l1.X1, Math.Min(l1.Y1, l2.Y1), l1.X1, Math.Max(l1.Y1, l2.Y1)), 54new(l1.X1, Math.Min(l1.Y2, l2.Y2), l1.X1, Math.Max(l1.Y2, l2.Y2)) 62new(Math.Min(l1.X1, l2.X1), l1.Y1, Math.Max(l1.X1, l2.X1), l1.Y1), 63new(Math.Min(l1.X2, l2.X2), l1.Y1, Math.Max(l1.X2, l2.X2), l1.Y1) 87return new Line(l1.X1, Math.Min(l1.Y1, l2.Y1), l1.X2, Math.Max(l1.Y2, l2.Y2), l1.LineType); 93return new Line(Math.Min(l1.X1, l2.X1), l1.Y1, Math.Max(l1.X2, l2.X2), l1.Y2, l1.LineType);
System\Windows\Forms\Design\Behavior\ResizeBehavior.cs (2)
704bounds.Y = Math.Min(baseBounds.Bottom - minHeight, baseBounds.Y - yOffset); 739bounds.X = Math.Min(baseBounds.Right - minWidth, baseBounds.X - xOffset);
System\Windows\Forms\Design\ComponentTray.cs (4)
1205_mouseDragWorkspace.X = Math.Min(start.X, end.X); 1206_mouseDragWorkspace.Y = Math.Min(start.Y, end.Y); 1340X = Math.Min(_mouseDragStart.X, e.X), 1341Y = Math.Min(_mouseDragStart.Y, e.Y),
System\Windows\Forms\Design\DataGridViewColumnCollectionDialog.cs (3)
805_selectedColumns.SelectedIndex = Math.Min(0, _selectedColumns.Items.Count - 1); 834_selectedColumns.SelectedIndex = Math.Min(_selectedColumns.Items.Count - 1, selectedIndex); 881_selectedColumns.SelectedIndex = Math.Min(selectedIndex, _selectedColumns.Items.Count - 1);
System\Windows\Forms\Design\DockEditor.DockUI.cs (2)
237: _leftRightOrder[Math.Min(i + 1, maxI)]; 279: _upDownOrder[Math.Min(i + 1, maxI)];
System\Windows\Forms\Design\ParentControlDesigner.cs (2)
2032Rectangle paintRect = new(Math.Min(displayRect.X, clientRect.X), 2033Math.Min(displayRect.Y, clientRect.Y),
System\Windows\Forms\Design\ToolStripCollectionEditor.ToolStripItemEditorForm.cs (1)
951index = Math.Max(0, Math.Min(index, _listBoxItems.Items.Count - 1));
System\Windows\Forms\Design\ToolStripDesigner.cs (1)
1037itemIndex = Math.Min(ToolStrip.Items.Count - 1, itemIndex);
System\Windows\Forms\Design\ToolStripDesignerUtils.cs (1)
547s_bitsPerPixel = (short)Math.Min(s.BitsPerPixel, s_bitsPerPixel);
System\Windows\Forms\Design\ToolStripItemBehavior.cs (1)
405int startIndexOfSelection = Math.Min(parent.Items.IndexOf(selectedItem), parent.Items.IndexOf(glyphItem));
System\Windows\Forms\Design\ToolStripMenuItemDesigner.cs (2)
1909itemIndex = Math.Min(ownerItem.DropDownItems.Count - 1, itemIndex); 2535int minIndex = Math.Min(ownerDropDown.Items.IndexOf(oldSelection), ownerDropDown.Items.IndexOf(MenuItem));
System.Windows.Forms.Primitives (7)
System\Windows\Forms\Automation\UiaTextRange.cs (5)
195End = Math.Min(Math.Max(End, Start + 1), text.Length); 247End = Math.Min(Math.Max(End, Start + 1), text.Length); 438maxLength = maxLength >= 0 ? Math.Min(Length, maxLength) : Length; 936moved = Math.Min(count, limit - index); 975moved = Math.Min(count, lineMax - line - 1);
System\Windows\Forms\Internals\UnicodeCharBuffer.cs (1)
51int count = Math.Min(s.Length, _buffer.Length - _offset);
Windows\Win32\PInvoke.GetModuleFileNameLongPath.cs (1)
41buffer.EnsureCapacity(Math.Min(buffer.Length * 2, short.MaxValue));
System.Windows.Forms.UI.IntegrationTests (2)
Infra\ScreenRecordService.cs (2)
547for (ReadOnlySpan<byte> remaining = bytes; !remaining.IsEmpty; remaining = remaining[Math.Min(buffer.Length, remaining.Length)..]) 549ReadOnlySpan<byte> current = remaining[..Math.Min(buffer.Length, remaining.Length)];
Test.Utilities (39)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
Text.Analyzers (42)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
566var maxSearchIndex = Math.Min(directoryPathParts.Length, fullPathParts.Length);
src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
99var maxSize = Math.Min(maxItemsToHash, values.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
97var n = Math.Min(n1, n2);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
972TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 988int arraySize = Math.Min(size, 4);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length); 505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed); 600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed); 738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed)); 787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length)); 794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
198var elementsInLastRowCappedAtMidwayPoint = Math.Min(elementsInLastIncompleteRow, elementsInLastRowIfTreeWerePerfect / 2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
148var overlapEnd = Math.Min(thisEnd, otherEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (2)
85Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 86Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
305Math.Min(fullSpan.Start, node.SpanStart),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
79var startSegmentEnd = Math.Min(span.End, except.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
248=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
374var segmentLength = Math.Min(buffer.Length, spanLength - offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
105return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
153var end = start + Math.Min(edgeCount, CompactEdgeAllocationSize); 263var end = start + Math.Min(currentNode.EdgeCount, CompactEdgeAllocationSize);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (2)
482threshold = Math.Min(threshold, targetLength); 499var jEnd = Math.Min(targetLength, i + minimumEditCount + offset);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\RoslynParallel.NetFramework.cs (1)
99rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (4)
196var copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position)); 232var copyCount = Math.Min(chunk.Length, count); 383var writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (1)
21var index = prefixIndex >= 0 && prohibitIndex >= 0 ? Math.Min(prefixIndex, prohibitIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamespaceOrTypeSymbolExtensions.cs (1)
45for (var i = 0; i < Math.Min(names1.Count, names2.Count); i++)
UIAutomationClientSideProviders (10)
MS\Internal\AutomationProxies\WindowsEditBox.cs (2)
365clientLocation.x = Math.Min(clientLocation.x, clientRect.right); 367clientLocation.y = Math.Min(clientLocation.y, clientRect.bottom);
MS\Internal\AutomationProxies\WindowsEditBoxRange.cs (5)
127End = Math.Min(Math.Max(End, Start + 1), text.Length); 161End = Math.Min(Math.Max(End, Start + 1), text.Length); 295return text.Substring(Start, maxLength >= 0 ? Math.Min(Length, maxLength) : Length); 823moved = Math.Min(count, limit - index); 868moved = Math.Min(count, lineMax - line - 1);
MS\Internal\AutomationProxies\WindowsListViewItem.cs (1)
946clickPoint.x = Math.Min ((itemRectangle.left + 5), (itemRectangle.left + itemRectangle.right) / 2);
MS\Internal\AutomationProxies\WindowsRichEditRange.cs (2)
77_range.SetRange(Math.Max(charRange.Start, paraRange.Start), Math.Min(charRange.End, paraRange.End)); 161int end = Math.Min(_range.End, visibleRange.End);
UIAutomationTypes (2)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\NativeMethodsCLR.cs (2)
2367int count = Math.Min(bytes.Length, buffer.Length - offset); 2423int count = Math.Min(s.Length, buffer.Length - offset);
VBCSCompiler (1)
src\Compilers\Server\VBCSCompiler\NamedPipeClientConnectionHost.cs (1)
69var listenCount = Math.Min(4, Environment.ProcessorCount);
WindowsFormsIntegration (4)
System\Windows\Integration\ElementHost.cs (2)
315int maxWidth = Math.Min(priorMaxSize.Width, maxElementSize.Width); 316int maxHeight = Math.Min(priorMaxSize.Height, maxElementSize.Height);
System\Windows\Integration\HostUtils.cs (2)
79Math.Min(size1.Width, size2.Width), 80Math.Min(size1.Height, size2.Height));
xunit.assert (3)
Sdk\AssertHelper.cs (1)
216 var end = Math.Min(start + 41, value.Length);
Sdk\CollectionTracker.cs (2)
593 var endIndex = Math.Min(span.Length - 1, startIndex + ArgumentFormatter.MAX_ENUMERABLE_LENGTH - 1); 734 var printLength = Math.Min(currentIndex + 1, ArgumentFormatter.MAX_ENUMERABLE_LENGTH);