471 references to Take
AnalyzerRunner (1)
DiagnosticAnalyzerRunner.cs (1)
139foreach (var pair in projectGroup.Take(5))
Aspire.Dashboard (7)
Components\Controls\ResourceActions.razor.cs (1)
86_highlightedCommands.AddRange(Resource.Commands.Where(c => c.IsHighlighted && c.State != CommandViewModelState.Hidden).Take(MaxHighlightedCount));
Components\Dialogs\FilterDialog.razor.cs (1)
133_filteredValues = newValues.Take(1000).ToList();
Components\Pages\ConsoleLogs.razor.cs (1)
377_highlightedCommands.AddRange(PageViewModel.SelectedResource.Commands.Where(c => c.IsHighlighted && c.State != CommandViewModelState.Hidden).Take(DashboardUIHelpers.MaxHighlightedCommands));
Components\Pages\Resources.razor.cs (2)
420.Take(request.Count ?? DashboardUIHelpers.DefaultDataGridResultCount) 698var tooltipBuilder = new StringBuilder(string.Join(", ", displayedUrls.Take(maxShownUrls).Select(url => url.Text)));
Components\Pages\TraceDetail.razor.cs (1)
117page = page.Take(request.Count ?? DashboardUIHelpers.DefaultDataGridResultCount);
Otlp\Model\OtlpHelpers.cs (1)
414var query = results.Skip(startIndex).Take(count);
CatalogService (1)
CatalogApi.cs (1)
28itemsOnPage.Take(pageSize));
GenerateDocumentationAndConfigFiles (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
installer.tasks (4)
StaticFileRegeneration\TpnDocument.cs (2)
34.Take(linesUntilNext) 54lines.Take(sections.First().Header.StartLine)),
StaticFileRegeneration\TpnSectionHeader.cs (2)
106if (nameLines.Take(nameLines.Length - 1).Any(IsSeparatorLine)) 132.Take(i)
Metrics (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Metrics.Legacy (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Microsoft.AspNetCore.Antiforgery.Test (1)
DefaultAntiforgeryTokenSerializerTest.cs (1)
171return data.Take(data.Length - 1).ToArray();
Microsoft.AspNetCore.Components.Endpoints (2)
FormMapping\Converters\CollectionAdapters\ImmutableQueueBufferAdapter.cs (1)
16return ImmutableQueue.CreateRange(buffer.Take(size));
FormMapping\Converters\CollectionAdapters\ImmutableStackBufferAdapter.cs (1)
16return ImmutableStack.CreateRange(buffer.Take(size));
Microsoft.AspNetCore.Components.Tests (10)
Rendering\ArrayBuilderTest.cs (10)
43Assert.Equal(new[] { value1, value2, value3 }, builder.Buffer.Take(3)); 61Assert.Equal(Enumerable.Repeat(5, capacity), builder.Buffer.Take(capacity)); 76Assert.Equal(new[] { 8, 8 }, builder.Buffer.Take(2)); 91Assert.Equal(array, builder.Buffer.Take(array.Length)); 107Assert.Equal(new[] { 118, 8, 8 }, builder.Buffer.Take(3)); 126Assert.Equal(array, builder.Buffer.Take(array.Length)); 143Assert.Equal(new[] { 7, 2, 9 }, builder.Buffer.Take(3)); 160Assert.Equal(new[] { 7, 2, 3, 9 }, builder.Buffer.Take(4)); 175Assert.Equal(new[] { 1, 2, 3 }, builder.Buffer.Take(3)); 192Assert.Equal(new[] { 1, 2, }, builder.Buffer.Take(2));
Microsoft.AspNetCore.Components.Web (2)
Virtualization\Virtualize.cs (2)
255.Take(lastItemIndex - _loadedItemsStartIndex); 453Items!.Skip(request.StartIndex).Take(request.Count),
Microsoft.AspNetCore.Components.WebAssembly.Tests (3)
PullFromJSDataStreamTest.cs (3)
130return ValueTask.FromResult((TValue)(object)_data.Skip((int)offset).Take(bytesToRead).ToArray()); 165return ValueTask.FromResult((TValue)(object)_data.Skip((int)offset).Take(bytesToRead - 1).ToArray()); 179return ValueTask.FromResult((TValue)(object)_data.Skip((int)offset).Take(bytesToRead + 1).ToArray());
Microsoft.AspNetCore.Cryptography.Internal.Tests (1)
Cng\BCryptUtilTests.cs (1)
44Guid newGuid = new Guid(bytes.Skip(3).Take(sizeof(Guid)).ToArray());
Microsoft.AspNetCore.DataProtection.Tests (1)
KeyManagement\KeyRingBasedDataProtectorTests.cs (1)
151badProtectedPayload = badProtectedPayload.Take(badProtectedPayload.Length - 1).ToArray(); // chop off the last byte
Microsoft.AspNetCore.Diagnostics (3)
src\Shared\StackTrace\ExceptionDetails\ExceptionDetailsProvider.cs (3)
153.Take(postErrorLineNumberInFile - preErrorLineNumberInFile + 1) 160frame.PreContextCode = codeBlock.Take(errorStartLineNumberInArray).ToArray(); 163.Take(numOfErrorLines)
Microsoft.AspNetCore.Hosting (3)
src\Shared\StackTrace\ExceptionDetails\ExceptionDetailsProvider.cs (3)
153.Take(postErrorLineNumberInFile - preErrorLineNumberInFile + 1) 160frame.PreContextCode = codeBlock.Take(errorStartLineNumberInArray).ToArray(); 163.Take(numOfErrorLines)
Microsoft.AspNetCore.Http.Extensions (2)
src\Components\Endpoints\src\FormMapping\Converters\CollectionAdapters\ImmutableQueueBufferAdapter.cs (1)
16return ImmutableQueue.CreateRange(buffer.Take(size));
src\Components\Endpoints\src\FormMapping\Converters\CollectionAdapters\ImmutableStackBufferAdapter.cs (1)
16return ImmutableStack.CreateRange(buffer.Take(size));
Microsoft.AspNetCore.Localization (1)
AcceptLanguageHeaderRequestCultureProvider.cs (1)
40languages = languages.Take(MaximumAcceptLanguageHeaderValuesToTry);
Microsoft.AspNetCore.Mvc.Core.Test (9)
ApplicationModels\ControllerActionDescriptorProviderTests.cs (2)
1416.Take(unorderedLineCount) 1422.Take(unorderedLineCount)
Infrastructure\ActionSelectionTableTest.cs (2)
334var expected = actions.Take(2).ToArray(); 383var expected = actions.Take(2).ToArray();
Infrastructure\ActionSelectorTest.cs (2)
254var expected = actions.Take(2).ToArray(); 306var expected = actions.Take(2).ToArray();
ModelBinding\Metadata\DefaultModelMetadataProviderTest.cs (1)
234defaultMetadata.Attributes.Attributes.Take(2),
ModelBinding\Metadata\ModelAttributesTest.cs (2)
207attributes.Attributes.Take(2), 217attributes.TypeAttributes.Take(1),
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (11)
Buffers\PagedCharBufferTest.cs (10)
59Assert.Equal(new[] { 'a', 'b', 'c', 't' }, page.Take(4)); 78Assert.Equal(stringToAppend.ToCharArray(), page.Take(PagedCharBuffer.PageSize - 1)); 128Assert.Equal(stringToAppend.ToCharArray(), page.Take(2 * PagedCharBuffer.PageSize - 1)); 145Assert.Equal(new[] { 'a', 'b', 'c' }, page.Take(buffer.Length)); 197page => Assert.Equal(expected2, page.Take(PagedCharBuffer.PageSize + 1))); 274Assert.Equal(new[] { 'a', 'b', 'c', 'd', 'e', 'f' }, page.Take(buffer.Length)); 290Assert.Equal(new[] { 'b', 'c', 'd' }, page.Take(buffer.Length)); 347page => Assert.Equal(expected2, page.Take(PagedCharBuffer.PageSize + 1))); 423Assert.Equal(new[] { 'A', 'b', 'c', 'd', 'e' }, page.Take(buffer.Length)); 478Assert.Equal(new[] { 'e', 'f', 'g', 'h' }, buffer.Pages[0].Take(buffer.Length));
ViewDataDictionaryTest.cs (1)
163{ model.Take(2) },
Microsoft.AspNetCore.Routing.Tests (1)
RouteCollectionTest.cs (1)
509var first = routeNames.Take(index).ToArray();
Microsoft.AspNetCore.Server.IIS (3)
src\Shared\StackTrace\ExceptionDetails\ExceptionDetailsProvider.cs (3)
153.Take(postErrorLineNumberInFile - preErrorLineNumberInFile + 1) 160frame.PreContextCode = codeBlock.Take(errorStartLineNumberInArray).ToArray(); 163.Take(numOfErrorLines)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (23)
BufferWriterTests.cs (1)
87Assert.Equal(array.Skip(offset).Take(length).ToArray(), Read());
Http2\Http2FrameWriterTests.cs (3)
47Assert.Equal(new byte[] { 0x00, 0x00, 0x00, 0x01 }, payload.Skip(Http2FrameReader.HeaderLength).Take(4).ToArray()); 69Assert.Equal(new byte[] { 0x00, 0x00, 0x00, 0x01 }, payload.Skip(Http2FrameReader.HeaderLength).Take(4).ToArray()); 87Assert.Equal(new byte[] { 0x00, 0x00, 0x00, 0x00 }, payload.Skip(5).Take(4).ToArray());
src\Shared\test\Shared.Tests\runtime\Http2\HuffmanDecodingTests.cs (9)
77Assert.Equal(input, decoded.Take(decodedByteCount)); 148yield return destination.Take(encodedByteCount - 1).ToArray(); 151yield return destination.Take(encodedByteCount - 2).ToArray(); 154yield return destination.Take(encodedByteCount - 3).ToArray(); 170yield return destination.Take(encodedByteCount).Concat(pad1).ToArray(); 171yield return destination.Take(encodedByteCount).Concat(pad2).ToArray(); 172yield return destination.Take(encodedByteCount).Concat(pad3).ToArray(); 173yield return destination.Take(encodedByteCount).Concat(pad4).ToArray(); 186yield return destination.Take(encodedByteCount).ToArray();
TlsListenerTests.cs (10)
275clientHello.Take(1).ToArray(), 276clientHello.Skip(1).Take(2).ToArray(), 277clientHello.Skip(3).Take(2).ToArray(), 278clientHello.Skip(5).Take(1).ToArray(), 279clientHello.Skip(6).Take(clientHello.Length - 6).ToArray() 294clientHelloSegments.Add(clientHello.Take(1).ToArray()); 298clientHelloSegments.Add(clientHello.Skip(1).Take(2).ToArray()); 302clientHelloSegments.Add(clientHello.Skip(3).Take(2).ToArray()); 306clientHelloSegments.Add(clientHello.Skip(5).Take(1).ToArray()); 310clientHelloSegments.Add(clientHello.Skip(6).Take(clientHello.Length - 6).ToArray());
Microsoft.AspNetCore.Shared.Tests (9)
runtime\Http2\HuffmanDecodingTests.cs (9)
77Assert.Equal(input, decoded.Take(decodedByteCount)); 148yield return destination.Take(encodedByteCount - 1).ToArray(); 151yield return destination.Take(encodedByteCount - 2).ToArray(); 154yield return destination.Take(encodedByteCount - 3).ToArray(); 170yield return destination.Take(encodedByteCount).Concat(pad1).ToArray(); 171yield return destination.Take(encodedByteCount).Concat(pad2).ToArray(); 172yield return destination.Take(encodedByteCount).Concat(pad3).ToArray(); 173yield return destination.Take(encodedByteCount).Concat(pad4).ToArray(); 186yield return destination.Take(encodedByteCount).ToArray();
Microsoft.AspNetCore.SignalR.Common.Tests (2)
Internal\Protocol\MemoryBufferWriterTests.cs (2)
92Assert.Equal(input, data.Take(16)); 113Assert.Equal(input, data.Take(16));
Microsoft.AspNetCore.SignalR.Core (1)
Internal\TypedClientBuilder.cs (1)
161paramTypes = paramTypes.Take(paramTypes.Length - 1).ToArray();
Microsoft.AspNetCore.TestHost.Tests (2)
TestClientTests.cs (2)
628Assert.True(hello.SequenceEqual(buffer.Take(hello.Length))); 633Assert.True(world.SequenceEqual(buffer.Take(world.Length)));
Microsoft.AspNetCore.WebSockets.Tests (2)
SendReceiveTests.cs (2)
57Assert.Equal(sendBuffer, receiveBuffer.Take(result.Count).ToArray()); 72Assert.Equal(sendBuffer, receiveBuffer.Take(result.Count).ToArray());
Microsoft.Build.Engine.OM.UnitTests (1)
Definition\Project_Tests.cs (1)
2317project.RemoveItems(project.GetItems("j").Take(2));
Microsoft.CodeAnalysis.Analyzers (7)
MetaAnalyzers\Fixers\CompareSymbolsCorrectlyFix.cs (1)
172if (AreCollectionsEqual(overload.Parameters.Take(methodArgsCount), methodSymbol.Parameters))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Microsoft.CodeAnalysis.AnalyzerUtilities (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Microsoft.CodeAnalysis.BannedApiAnalyzers (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Microsoft.CodeAnalysis.CodeStyle (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Microsoft.CodeAnalysis.CSharp (2)
Symbols\TypeUnification.cs (2)
212t1.CustomModifiers.SequenceEqual(t2.CustomModifiers.Take(t1.CustomModifiers.Length))) 231t2.CustomModifiers.SequenceEqual(t1.CustomModifiers.Take(t2.CustomModifiers.Length)))
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxListExtensions.cs (1)
23=> [.. list.Take(index).Concat(item).Concat(list.Skip(index))];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
264var numberOfLinesBeforeComment = GetNumberOfLines(triviaList.Take(triviaList.IndexOf(firstNonWhitespaceTrivia)));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (11)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
376trailingTrivia.Take(trailingTrivia.Count - 1));
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
418return allNamespaces.Take(2).Count() == 1;
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (1)
86return triviaList.Take(lastIndex);
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (2)
68.WithLeadingTrivia(leadingTrivia.Take(skippedTriviaIndex)) 69.WithTrailingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Take(trailingTriviaTakeUntil)));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
861: nodeOrToken.WithTrailingTrivia(trivia.Take(index));
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
175var finalArgumentsWithSeparators = argumentsWithSeparators.Take(indexToWrap * 2).Concat(wrappedArgument);
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
365leadingTrivia.Take(leadingTrivia.Count - 1).Concat(Whitespace(elementLeadingWhitespace[..^indentation.Length])));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
603statementsArray[0].WithPrependedLeadingTrivia(closeBraceTrivia.Take(splitIndex)));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\QueryExpressionSyntaxExtensions.cs (1)
44var clauses = SyntaxFactory.List(allClauses.Take(allClauses.Count() - 1).Cast<QueryClauseSyntax>());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
138openBrace.TrailingTrivia.Concat(closeBrace.LeadingTrivia.Take(index + 1)));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\CodeGenCapturing.cs (1)
98.Take(numToCapture));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Semantics\ParamsCollectionTests.cs (1)
119var nodes = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Take(3).ToArray();
Microsoft.CodeAnalysis.CSharp.Features (11)
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider_DocumentationComments.cs (1)
104content[^1] = xmlText.WithTextTokens([.. tokens.Take(lastIndex)]);
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (1)
138triviaToMove = [.. triviaToMove.Take(triviaToMove.Count - 2)];
EditAndContinue\SyntaxComparer.cs (1)
1610=> enumerable is null ? [] : [.. enumerable.Take(LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation)];
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
376trailingTrivia.Take(trailingTrivia.Count - 1));
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
418return allNamespaces.Take(2).Count() == 1;
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (1)
86return triviaList.Take(lastIndex);
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (2)
68.WithLeadingTrivia(leadingTrivia.Take(skippedTriviaIndex)) 69.WithTrailingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Take(trailingTriviaTakeUntil)));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
861: nodeOrToken.WithTrailingTrivia(trivia.Take(index));
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
175var finalArgumentsWithSeparators = argumentsWithSeparators.Take(indexToWrap * 2).Concat(wrappedArgument);
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
365leadingTrivia.Take(leadingTrivia.Count - 1).Concat(Whitespace(elementLeadingWhitespace[..^indentation.Length])));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\UnsafeTests.cs (3)
10177var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(3).Reverse().ToArray(); 10223var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray(); 10297var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\LookupSymbolsInfoTests.cs (1)
78return string.Format("<{0}>", string.Join(",", TemplateArgEnumerable.Instance.Take(arity)));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (2)
Parsing\ParserErrorMessageTests.cs (1)
1653var firstDiag = parsedTree.GetDiagnostics().Take(1);
Parsing\ParsingTests.cs (1)
77actualErrors.Take(1).Verify(expectedFirstError);
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (2)
PdbTests.cs (2)
98AssertEx.Equal(new byte[] { 0x12, (byte)'M', (byte)'i', (byte)'c', (byte)'r', (byte)'o' }, pdbStream.GetBuffer().Take(6).ToArray()); 99AssertEx.Equal(new byte[] { 0x12, (byte)'M', (byte)'Z' }, peStream.GetBuffer().Take(3).ToArray());
Microsoft.CodeAnalysis.CSharp.Workspaces (6)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
3114=> RemoveNodes(declaration, GetSubDeclarations(declaration).Skip(index).Take(count));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxListExtensions.cs (1)
23=> [.. list.Take(index).Concat(item).Concat(list.Skip(index))];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
264var numberOfLinesBeforeComment = GetNumberOfLines(triviaList.Take(triviaList.IndexOf(firstNonWhitespaceTrivia)));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
603statementsArray[0].WithPrependedLeadingTrivia(closeBraceTrivia.Take(splitIndex)));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\QueryExpressionSyntaxExtensions.cs (1)
44var clauses = SyntaxFactory.List(allClauses.Take(allClauses.Count() - 1).Cast<QueryClauseSyntax>());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
138openBrace.TrailingTrivia.Concat(closeBrace.LeadingTrivia.Take(index + 1)));
Microsoft.CodeAnalysis.EditorFeatures (1)
InlineRename\UI\SmartRename\SmartRenameViewModel.cs (1)
279foreach (var name in _smartRenameSession.SuggestedNames.Take(3))
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Rename\RenamerTests.cs (1)
119return [.. splitPath.Take(splitPath.Length - 1)];
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
Utilities\BloomFilterTests.cs (2)
48var strings = new HashSet<string>(GenerateStrings(2000).Skip(500).Take(1000), comparer); 168var longs = CreateLongs([.. GenerateStrings(2000).Skip(500).Take(1000).Select(s => s.GetHashCode())]);
Microsoft.CodeAnalysis.Features (19)
AddPackage\InstallPackageDirectlyCodeActionOperation.cs (1)
53_projectsWithMatchingVersion.AddRange(otherProjects.Take(projectsToShow).Select(p => p.Name));
ChangeSignature\AbstractChangeSignatureService.cs (1)
479var argumentsToPermute = arguments.Take(declarationParametersToPermute.Length).ToList();
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (1)
394builder.Add(string.Join(".", parts.Take(i)));
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs (1)
92.Select(i => (foldername: string.Join(".", parts.Take(i)), index: i))
FullyQualify\AbstractFullyQualifyService.cs (1)
100.Take(MaxResults)
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.ConstructorDelegatingCodeAction.cs (1)
49[.. _state.Parameters.Take(_state.DelegatedConstructor.Parameters.Length)]);
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.State.cs (1)
109let symbolTypes = parameters.Take(c.Parameters.Length).Select(p => p.Type)
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (3)
175.Take(declarationStatementIndex) 255.Take(statementIndex) 340.Take(lastUsageStatementIndex + 1)
InvertIf\AbstractInvertIfCodeRefactoringProvider.cs (6)
476var statementsBeforeIf = statements.Take(index); 528var statementsBeforeIf = statements.Take(index); 554var statementsBeforeIf = statements.Take(index); 569var statementsBeforeIf = statements.Take(index); 575.Take(statementsAfterIf.Count() - 1) 602var statementsBeforeIf = statements.Take(index);
MoveStaticMembers\MoveStaticMembersOptions.cs (1)
65NamespaceDisplay = string.Join(separator: ".", namespacesAndType.Take(namespacesAndType.Length - 1));
Snippets\SnippetProviders\AbstractSnippetProvider.cs (1)
131var nodeWithTrivia = node.ReplaceTokens(allTokens.Skip(1).Take(allTokens.Count - 2),
SplitOrMergeIfStatements\Nested\AbstractMergeNestedIfStatementsCodeRefactoringProvider.cs (1)
216if (!remainingStatements.SequenceEqual(remainingOuterStatements.Take(statements.Count - 1), syntaxFacts.AreEquivalent))
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
SpellCheck\SpellCheckTests.cs (1)
100Ranges = [.. allRanges.Skip(3 * i * 1000).Take(3 * 1000)],
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Microsoft.CodeAnalysis.PublicApiAnalyzers (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Microsoft.CodeAnalysis.Rebuild (1)
CompilationOptionsReader.cs (1)
180foreach (var documentHandle in PdbReader.Documents.Take(sourceFileCount))
Microsoft.CodeAnalysis.ResxSourceGenerator (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Microsoft.CodeAnalysis.Test.Utilities (2)
Assert\AssertEx.cs (2)
688var expectedString = string.Join(itemSeparator, expected.Take(10).Select(itemInspector)); 847File.WriteAllLines(actualFile, testFileLines.Take(expectedValueSourceLine));
Microsoft.CodeAnalysis.UnitTests (20)
Collections\ImmutableListTestBase.cs (1)
100Assert.Equal(enumerable.Take(array.Length), array);
Collections\ImmutablesTestBase.nonnetstandard.cs (2)
43var shorterSequence = equivalentSequence.Take(equivalentSequence.Count() - 1); 46var nonUniqueSubsetSequenceOfSameLength = shorterSequence.Concat(shorterSequence.Take(1));
Collections\List\ICollection.Generic.Tests.cs (1)
546Assert.True(Enumerable.SequenceEqual(collection, array.Take(count)));
CryptoBlobParserTests.cs (14)
36var expectedModulus = key.Skip(HEADER_LEN).Take(MOD_LEN).ToArray(); 40var expectedP = key.Skip(HEADER_LEN + MOD_LEN).Take(HALF_LEN).ToArray(); 44var expectedQ = key.Skip(HEADER_LEN + MOD_LEN + HALF_LEN).Take(HALF_LEN).ToArray(); 48var expectedDP = key.Skip(HEADER_LEN + MOD_LEN + HALF_LEN * 2).Take(HALF_LEN).ToArray(); 52var expectedDQ = key.Skip(HEADER_LEN + MOD_LEN + HALF_LEN * 3).Take(HALF_LEN).ToArray(); 56var expectedInverseQ = key.Skip(HEADER_LEN + MOD_LEN + HALF_LEN * 4).Take(HALF_LEN).ToArray(); 60var expectedD = key.Skip(HEADER_LEN + MOD_LEN + HALF_LEN * 5).Take(MOD_LEN).ToArray(); 79var expectedModulus = key.Skip(HEADER_LEN).Take(MOD_LEN).ToArray(); 83var expectedP = key.Skip(HEADER_LEN + MOD_LEN).Take(HALF_LEN).ToArray(); 87var expectedQ = key.Skip(HEADER_LEN + MOD_LEN + HALF_LEN).Take(HALF_LEN).ToArray(); 91var expectedDP = key.Skip(HEADER_LEN + MOD_LEN + HALF_LEN * 2).Take(HALF_LEN).ToArray(); 95var expectedDQ = key.Skip(HEADER_LEN + MOD_LEN + HALF_LEN * 3).Take(HALF_LEN).ToArray(); 99var expectedInverseQ = key.Skip(HEADER_LEN + MOD_LEN + HALF_LEN * 4).Take(HALF_LEN).ToArray(); 103var expectedD = key.Skip(HEADER_LEN + MOD_LEN + HALF_LEN * 5).Take(MOD_LEN).ToArray();
Text\SourceTextStreamTests.cs (2)
55Assert.True(buffer.Take(baseText.Length).SequenceEqual(encoding.GetBytes(baseText))); 58Assert.True(buffer.Take(3).SequenceEqual(encoding.GetBytes(new[] { '\u2019' })));
Microsoft.CodeAnalysis.Workspaces (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
MSBuild\MSBuildProjectLoader.Worker.cs (1)
467? [.. pathNames.Take(pathNames.Length - 1)]
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
UtilityTest\EditDistanceTests.cs (1)
265var top = Top1000.Take(50).ToArray();
Microsoft.Data.Analysis.Tests (1)
DataFrameTests.Utils.cs (1)
225IEnumerable<int> trainIndices = randomIndices.Take((int)(input.Rows.Count * testRatio));
Microsoft.DotNet.Build.Tasks.VisualStudio (1)
Vsix\GetPkgDefAssemblyDependencyGuid.cs (1)
62byte[] reducedHash = fullHash.Take(targetBlockSize).Zip(fullHash.Skip(targetBlockSize), (b1, b2) => (byte)(b1 ^ b2)).ToArray();
Microsoft.DotNet.Deployment.Tasks.Links (1)
Microsoft.Extensions.AI.Evaluation.NLP (2)
Common\NGramExtensions.cs (2)
30T[] output = [.. input.Take(n)]; 37output = [.. input.Take(n)];
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Storage\DiskBasedResultStore.cs (1)
195executionDirs = executionDirs.Take(count.Value);
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Storage\AzureStorageResultStore.cs (1)
51foreach (PathItem item in paths.OrderByDescending(item => item.CreatedOn ?? DateTimeOffset.MinValue).Take(count ?? 1))
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (3)
ResultStoreTester.cs (3)
146Assert.True(results.Take(3).All(r => r.executionName == thirdExecutionName)); 147Assert.True(results.Skip(3).Take(3).All(r => r.executionName == secondExecutionName)); 148Assert.True(results.Skip(6).Take(3).All(r => r.executionName == firstExecutionName));
Microsoft.Maui.Controls (2)
ObservableList.cs (1)
74 T[] items = Items.Skip(index).Take(count).ToArray();
TemplatedItemsList.cs (1)
1048 TItem[] itemsToMove = _templatedObjects.Skip(e.OldStartingIndex).Take(e.OldItems.Count).ToArray();
Microsoft.Maui.Controls.Build.Tasks (2)
SetPropertiesVisitor.cs (2)
965 il.Append(DigProperties(properties.Take(properties.Count - 1), locs, () => 1097 il.Append(DigProperties(properties.Take(i), locs, null, node as IXmlLineInfo, module));
Microsoft.ML.AutoML (7)
ColumnInference\TextFileSample.cs (1)
294if (buffer.Take(sniffLim).Any(x => x == 0))
PipelineSuggesters\PipelineSuggester.cs (2)
98history = history.Take(availableTrainers.Count()).Where(x => x.RunSucceeded); 106var topTrainers = sortedHistory.Take(TopKTrainers).Select(r => r.Pipeline.Trainer);
Sweepers\SmacSweeper.cs (1)
212return retainedConfigs.Take(numOfCandidates).ToArray();
Tuner\SmacTuner.cs (2)
172var bestKParamSets = _histories.OrderBy(i => i.Loss).Take(_localSearchParentCount).Select(r => r.TrialSettings.Parameter); 219return retainedConfigs.Take(numOfCandidates).ToArray();
Utils\BestResultUtil.cs (1)
91return orderedResults.Take(n);
Microsoft.ML.AutoML.Tests (2)
GetNextPipelineTests.cs (1)
76var stage1Runs = history.Take(allAvailableTrainers.Count());
TunerTests.cs (1)
135var newCfo = new CostFrugalTuner(searchSpace, Parameter.FromObject(initValues), history.Take(99), seed);
Microsoft.ML.Data (10)
Data\DataViewUtils.cs (1)
1401var stringRep = string.Join(",", vbuf.Items(true).Take(previewValues)
Deprecated\Instances\HeaderSchema.cs (1)
94int cnn = names.Take(size).Count(x => x != null);
Dirty\PredictionUtils.cs (1)
83res = new List<string>(args.Take(i));
Evaluators\AnomalyDetectionEvaluator.cs (5)
165names.AddRange(agg.Names.Take(agg.NumTopExamples)); 166scores.AddRange(agg.Scores.Take(agg.NumTopExamples)); 167labels.AddRange(agg.Labels.Take(agg.NumTopExamples)); 262drAtNumPos = sorted.Take((int)NumAnomalies).Count(result => result.Label > 0) / (Double)NumAnomalies; 263thresholdAtNumPos = sorted.Take((int)NumAnomalies).Last().Score;
Evaluators\MulticlassClassificationEvaluator.cs (1)
312public double[] AllTopKAccuracy => CumulativeSum(_seenRanks.Take(OutputTopKAcc ?? 0).Select(l => l / _numInstances)).ToArray();
Prediction\Calibrator.cs (1)
1399return _data.Take(_itemsSeen).GetEnumerator();
Microsoft.ML.Ensemble (1)
Selector\SubModelSelector\BaseBestPerformanceSelector.cs (1)
42return sortedModels.Where(m => m != null).Take(modelCountToBeSelected).ToList();
Microsoft.ML.FastTree (4)
GamModelParameters.cs (2)
177int diff = _binEffects.Sum(e => e.Take(e.Length - 1).Select((ef, i) => ef != e[i + 1] ? 1 : 0).Sum()); 820UpperBounds = up.Take(up.Length - 1);
Training\DocumentPartitioning.cs (1)
106var cumulativeLength = _leafCount.CumulativeSum<int>().Take(tree.NumLeaves - 1);
TreeEnsemble\InternalTreeEnsemble.cs (1)
321FeatureToGainMap gainMap = new FeatureToGainMap(_trees.Take(prefix).ToList(), normalize);
Microsoft.ML.GenAI.Core (2)
Extension\ModuleExtension.cs (1)
224var topK = layerSizeMap.Take(count).ToList();
Trainer\CausalLMDataset.cs (1)
89var train = inputIds.Concat(labelIds.Take(i)).ToArray();
Microsoft.ML.GenAI.Mistral (1)
Mistral_7B_0_3ChatTemplateBuilder.cs (1)
40var firstSequence = messages.Take(messages.ToList().FindLastIndex(m => m.GetRole() == Role.User));
Microsoft.ML.Mkl.Components (1)
VectorWhitening.cs (1)
660var modelName = ctx.AddInitializer(model.Take(rank * dimension), modelDimension, "model");
Microsoft.ML.Parquet (3)
PartitionedFileLoader.cs (1)
398_subActive = _active.Take(SubColumnCount).ToArray();
PartitionedPathParser.cs (2)
193return dirs.Take(dirs.Count() - 1); // Ignore last directory which is the file name. 340dirs = dirs.Take(dirs.Count() - 1); // Ignore last directory which is the file name.
Microsoft.ML.Samples (64)
Dynamic\ModelOperations\OnnxConversion.cs (2)
24foreach (var value in values.Take(numRows)) 30foreach (var value in values.Take(numRows))
Dynamic\TensorFlow\ImageClassification.cs (1)
60foreach (var classScore in prediction.output.Take(3))
Dynamic\Trainers\BinaryClassification\AveragedPerceptron.cs (1)
47foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\AveragedPerceptronWithOptions.cs (1)
58foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\Calibrators\FixedPlatt.cs (2)
78foreach (var value in values.Take(numRows)) 86foreach (var value in values.Take(numRows))
Dynamic\Trainers\BinaryClassification\Calibrators\Isotonic.cs (2)
78foreach (var value in values.Take(numRows)) 86foreach (var value in values.Take(numRows))
Dynamic\Trainers\BinaryClassification\Calibrators\Naive.cs (2)
78foreach (var value in values.Take(numRows)) 86foreach (var value in values.Take(numRows))
Dynamic\Trainers\BinaryClassification\Calibrators\Platt.cs (2)
78foreach (var value in values.Take(numRows)) 86foreach (var value in values.Take(numRows))
Dynamic\Trainers\BinaryClassification\FactorizationMachine.cs (1)
55foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\FastForest.cs (1)
50foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\FastForestWithOptions.cs (1)
62foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\FastTree.cs (1)
50foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\FastTreeWithOptions.cs (1)
62foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\FieldAwareFactorizationMachine.cs (1)
84foreach (var dataPoint in data.Take(5))
Dynamic\Trainers\BinaryClassification\FieldAwareFactorizationMachineWithOptions.cs (1)
95foreach (var dataPoint in data.Take(5))
Dynamic\Trainers\BinaryClassification\LbfgsLogisticRegression.cs (1)
47foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\LbfgsLogisticRegressionWithOptions.cs (1)
56foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\LdSvm.cs (1)
47foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\LdSvmWithOptions.cs (1)
56foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\LightGbm.cs (1)
50foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\LightGbmWithOptions.cs (1)
61foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\LinearSvm.cs (1)
47foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\LinearSvmWithOptions.cs (1)
56foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\PriorTrainer.cs (1)
47foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\SdcaLogisticRegression.cs (1)
55foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\SdcaLogisticRegressionWithOptions.cs (1)
67foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\SdcaNonCalibrated.cs (1)
55foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\SdcaNonCalibratedWithOptions.cs (1)
69foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\SgdCalibrated.cs (1)
47foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\SgdCalibratedWithOptions.cs (1)
59foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\SgdNonCalibrated.cs (1)
47foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\SgdNonCalibratedWithOptions.cs (1)
56foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\SymbolicSgdLogisticRegression.cs (1)
50foreach (var p in predictions.Take(5))
Dynamic\Trainers\BinaryClassification\SymbolicSgdLogisticRegressionWithOptions.cs (1)
59foreach (var p in predictions.Take(5))
Dynamic\Trainers\Clustering\KMeans.cs (3)
47foreach (var p in predictions.Take(2)) 81string.Join(", ", centroids[0].GetValues().ToArray().Take(3))); 85string.Join(", ", centroids[1].GetValues().ToArray().Take(3)));
Dynamic\Trainers\Clustering\KMeansWithOptions.cs (3)
55foreach (var p in predictions.Take(2)) 89string.Join(", ", centroids[0].GetValues().ToArray().Take(3))); 93string.Join(", ", centroids[1].GetValues().ToArray().Take(3)));
Dynamic\Trainers\MulticlassClassification\LbfgsMaximumEntropy.cs (1)
52foreach (var p in predictions.Take(5))
Dynamic\Trainers\MulticlassClassification\LbfgsMaximumEntropyWithOptions.cs (1)
60foreach (var p in predictions.Take(5))
Dynamic\Trainers\MulticlassClassification\LightGbm.cs (1)
55foreach (var p in predictions.Take(5))
Dynamic\Trainers\MulticlassClassification\LightGbmWithOptions.cs (1)
65foreach (var p in predictions.Take(5))
Dynamic\Trainers\MulticlassClassification\NaiveBayes.cs (1)
58foreach (var p in predictions.Take(5))
Dynamic\Trainers\MulticlassClassification\OneVersusAll.cs (1)
53foreach (var p in predictions.Take(5))
Dynamic\Trainers\MulticlassClassification\PairwiseCoupling.cs (1)
53foreach (var p in predictions.Take(5))
Dynamic\Trainers\MulticlassClassification\SdcaMaximumEntropy.cs (1)
60foreach (var p in predictions.Take(5))
Dynamic\Trainers\MulticlassClassification\SdcaMaximumEntropyWithOptions.cs (1)
69foreach (var p in predictions.Take(5))
Dynamic\Trainers\MulticlassClassification\SdcaNonCalibrated.cs (1)
60foreach (var p in predictions.Take(5))
Dynamic\Trainers\MulticlassClassification\SdcaNonCalibratedWithOptions.cs (1)
69foreach (var p in predictions.Take(5))
Dynamic\Trainers\Recommendation\MatrixFactorization.cs (1)
48reuseRowObject: false).Take(5).ToList();
Dynamic\Trainers\Recommendation\MatrixFactorizationWithOptions.cs (1)
72reuseRowObject: false).Take(5).ToList();
Dynamic\Trainers\Recommendation\OneClassMatrixFactorizationWithOptions.cs (2)
81foreach (var pred in results.Take(15)) 114.OrderByDescending(element => element.Score).Take(2);
Dynamic\Transforms\ApplyOnnxModel.cs (1)
39foreach (var classScore in prediction.softmaxout_1.Take(3))
Dynamic\Transforms\ImageAnalytics\ConvertToImage.cs (2)
78features.DenseValues().Take(5)) + "...", 80string.Join(",", pixels.DenseValues().Take(5)) + "...");
Dynamic\Transforms\ImageAnalytics\ExtractPixels.cs (1)
113string.Join(",", pixels.DenseValues().Take(5)) + "...");
Microsoft.ML.Samples.GPU (1)
docs\samples\Microsoft.ML.Samples\Dynamic\TensorFlow\ImageClassification.cs (1)
60foreach (var classScore in prediction.output.Take(3))
Microsoft.ML.SearchSpace (2)
Option\NestOption.cs (1)
56var feature = values.Skip(startIndex).Take(dim).ToArray();
SearchSpace.cs (1)
118var input = feature.Skip(cur).Take(option.FeatureSpaceDim).ToArray();
Microsoft.ML.StandardTrainers (2)
Standard\ModelStatistics.cs (1)
467var order = GetUnorderedCoefficientStatistics().OrderByDescending(stat => stat.ZScore).Take(paramCountCap - 1);
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (1)
444var labelHistogram = ctx.AddInitializer(labelHistogramExpanded.Take(_labelHistogram.Length), new long[] { _labelHistogram.Length, 1 }, "labelHistogram");
Microsoft.ML.Sweeper (1)
Algorithms\SmacSweeper.cs (1)
219foreach (Tuple<double, ParameterSet> t in bestConfigurations.Take(numOfCandidates))
Microsoft.ML.Tests (18)
Scenarios\Api\CookbookSamples\CookbookSamplesDynamicApi.cs (8)
58.Take(4).ToArray(); 65.Take(20).ToArray(); 516var messageTexts = data.GetColumn<string>(data.Schema["Message"]).Take(20).ToArray(); 550var embeddings = transformedData.GetColumn<float[]>(transformedData.Schema["Embeddings"]).Take(10).ToArray(); 551var unigrams = transformedData.GetColumn<float[]>(transformedData.Schema["BagOfWords"]).Take(10).ToArray(); 590var catColumns = data.GetColumn<string[]>(data.Schema["CategoricalFeatures"]).Take(10).ToArray(); 606var categoricalBags = transformedData.GetColumn<float[]>(transformedData.Schema["CategoricalBag"]).Take(10).ToArray(); 607var workclasses = transformedData.GetColumn<float[]>(transformedData.Schema["WorkclassOneHotTrimmed"]).Take(10).ToArray();
Scenarios\Api\Estimators\DecomposableTrainAndPredict.cs (1)
44foreach (var input in testData.Take(20))
Scenarios\Api\Estimators\Extensibility.cs (1)
53foreach (var input in testData.Take(20))
Scenarios\Api\Estimators\PredictAndMetadata.cs (1)
62foreach (var input in testData.Take(20))
Scenarios\Api\Estimators\SimpleTrainAndPredict.cs (2)
43foreach (var input in testData.Take(5)) 82foreach (var input in testData.Take(5))
TrainerEstimators\MatrixFactorizationTests.cs (1)
701var topColumns = results.Where(element => element.MatrixRowIndex == 1).OrderByDescending(element => element.Score).Take(2);
TrainerEstimators\SymSgdClassificationTests.cs (3)
47var col1 = data.GetColumn<float>(data.Schema["Score"]).Take(numExamples).ToArray(); 48var col2 = outInitData.GetColumn<float>(outInitData.Schema["Score"]).Take(numExamples).ToArray(); 49var col3 = outNoInitData.GetColumn<float>(outNoInitData.Schema["Score"]).Take(numExamples).ToArray();
Transformers\TextFeaturizerTests.cs (1)
764foreach (var input in testData.Take(5))
Microsoft.ML.Tokenizers.Tests (28)
BpeTests.cs (3)
482Assert.Equal(expectedIds.Take(expectedIds.Length - 2), tokenizer.EncodeToIds(text, expectedIds.Length - 2, out normalizedText, out length)); 486Assert.Equal(expectedIds.Take(expectedIds.Length - 2), tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length - 2, out normalizedText, out length)); 820Assert.Equal(ids.Take(i), subIds);
CodeGenTests.cs (8)
401Assert.Equal(ids.Take(ids.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text, ids.Length - 1, out normalizedText, out length)); 406Assert.Equal(ids.Take(ids.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text.AsSpan(), ids.Length - 1, out normalizedText, out length)); 410Assert.Equal(expectedIds.Take(expectedIds.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text, expectedIds.Length - 1, addPrefixSpace: false, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length)); 413Assert.Equal(expectedIds.Take(expectedIds.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length - 1, addPrefixSpace: false, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length)); 417Assert.Equal(expectedIdsWithSpace.Take(expectedIdsWithSpace.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text, expectedIdsWithSpace.Length - 1, addPrefixSpace: true, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length)); 420Assert.Equal(expectedIdsWithSpace.Take(expectedIdsWithSpace.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text.AsSpan(), expectedIdsWithSpace.Length - 1, addPrefixSpace: true, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length)); 1000Assert.Equal(encodingIds.Take(expectedTokenCount), ids); 1005Assert.Equal(encodingIds.Take(expectedTokenCount), ids);
EnglishRobertaTests.cs (2)
201Assert.Equal(expectedIds.Take(expectedIds.Length - 2), tokenizer.EncodeToIds(text, expectedIds.Length - 2, out normalizedText, out length)); 205Assert.Equal(expectedIds.Take(expectedIds.Length - 2), tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length - 2, out normalizedText, out length));
LlamaTests.cs (4)
596Assert.Equal(expectedIds1.Take(expectedIds1.Length - 6), sentencePieceBpe.EncodeToIds( 606(int Index, int Length)[] expectedOffsets1 = addBeginningOfSentence ? expectedOffsets.Take(expectedIds1.Length - 6).ToArray() : expectedOffsets.Skip(1).Take(expectedIds1.Length - 6).ToArray(); 611Assert.Equal(expectedIds1.Take(expectedIds1.Length - 6), sentencePieceBpe.EncodeToIds(
TiktokenTests.cs (2)
607Assert.Equal(expectedIds.Take(expectedIds.Length - 4), tokenizer.EncodeToIds(text, expectedIds.Length - 4, out normalizedText, out length)); 611Assert.Equal(expectedIds.Take(expectedIds.Length - 4), tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length - 4, out normalizedText, out length));
TokenizerTests.cs (2)
144Assert.Equal(fullIdsList.Take(partialIdsList.Count), partialIdsList); 166Assert.Equal(prefixIds, fullIdsList.Take(prefixIds.Count));
UnigramTests.cs (6)
424Assert.Equal(ids.Take(i), result); 428Assert.Equal(ids.Take(i), result); 441Assert.Equal(ids.Take(i - 1), ints); // Exclude the counted BoS token 457Assert.Equal(ids.Take(i - 1), ints); // Exclude the counted BoS token 476Assert.Equal(expectedIds.Take(i), result); 480Assert.Equal(expectedIds.Take(i), result);
WordPieceTests.cs (1)
93Assert.Equal(ids.Take(expectedTokenCount[i - 1]).ToArray(), tokenizer.EncodeToIds(text, maxTokenCount: i, normalizedText: out _, out tokenCount));
Microsoft.ML.TorchSharp (1)
Utils\MetricUtils.cs (1)
48topK = topK.OrderByDescending(tuple => tuple.score).Take(k).ToList();
Microsoft.ML.Vision (1)
ImageClassificationTrainer.cs (1)
873validationSetCount, featureLength, featurizedImages.Take(validationSetCount));
Microsoft.NET.StringTools (1)
WeakStringCacheInterner.cs (1)
153.Take(15)
Microsoft.NET.StringTools.net35 (1)
WeakStringCacheInterner.cs (1)
153.Take(15)
Microsoft.VisualStudio.LanguageServices (1)
PreviewPane\PreviewPane.xaml.cs (1)
166previewItems = previewItems.Take(MaxItems).Concat("...").ToList();
PresentationFramework (1)
MS\Internal\WindowsRuntime\Generated\WinRT\GuidGenerator.cs (1)
125return new Guid(data.Take(16).ToArray());
Roslyn.Diagnostics.Analyzers (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Roslyn.Diagnostics.CSharp.Analyzers (5)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxListExtensions.cs (1)
23=> [.. list.Take(index).Concat(item).Concat(list.Skip(index))];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
264var numberOfLinesBeforeComment = GetNumberOfLines(triviaList.Take(triviaList.IndexOf(firstNonWhitespaceTrivia)));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
603statementsArray[0].WithPrependedLeadingTrivia(closeBraceTrivia.Take(splitIndex)));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\QueryExpressionSyntaxExtensions.cs (1)
44var clauses = SyntaxFactory.List(allClauses.Take(allClauses.Count() - 1).Cast<QueryClauseSyntax>());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
138openBrace.TrailingTrivia.Concat(closeBrace.LeadingTrivia.Take(index + 1)));
System.ComponentModel.Composition (1)
System\ComponentModel\Composition\Hosting\TypeCatalog.cs (1)
375foreach (ReflectionComposablePartDefinition definition in PartsInternal.Take(displayCount))
System.Drawing.Common.Tests (1)
System\Drawing\Drawing2D\LinearGradientBrushTests.cs (1)
538Assert.Equal(colors.Take(2).Select(c => Color.FromArgb(c.ToArgb())), brush.LinearColors);
System.Linq (1)
System\Linq\Shuffle.SpeedOpt.cs (1)
155!onlyIfCheap ? _source.Take(_takeCount).Count() :
System.Linq.Parallel (1)
System\Linq\Parallel\QueryOperators\Unary\TakeOrSkipQueryOperator.cs (1)
321return Child.AsSequentialQuery(token).Take(_count);
System.Windows.Forms.Tests (10)
System\Windows\Forms\ListBindingHelperTests.cs (10)
325yield return new object[] { new MultiListDataClass { ParentListProperty = [new() { ListProperty = [new()] }] }, TypeDescriptor.GetProperties(typeof(MultiListDataClass)).Cast<PropertyDescriptor>().Take(0).ToArray(), new string[] { "ParentListProperty" } }; 328yield return new object[] { new MultiListDataClass { ParentListProperty = [new() { ListProperty = [new()] }] }, inner.Take(2).ToArray(), new string[] { "Property" } }; 339yield return new object[] { new IEnumerableWrapper(new object[] { new MultiListDataClass() }), inner.Take(2).ToArray(), new string[] { "Property" } }; 346yield return new object[] { new ArrayList { new MultiListDataClass() }, inner.Take(0).ToArray(), new string[] { "ParentListProperty" } }; 347yield return new object[] { new ArrayList { new MultiListDataClass() }, inner.Take(2).ToArray(), new string[] { "Property" } }; 348yield return new object[] { new ArrayList { new MultiListDataClass { ParentListProperty = [] } }, inner.Take(0).ToArray(), new string[] { "ParentListProperty" } }; 349yield return new object[] { new ArrayList { new MultiListDataClass { ParentListProperty = [] } }, inner.Take(2).ToArray(), new string[] { "Property" } }; 350yield return new object[] { new ArrayList { new MultiListDataClass { ParentListProperty = [new() { ListProperty = [new()] }] } }, inner.Take(0).ToArray(), new string[] { "ParentListProperty" } }; 351yield return new object[] { new ArrayList { new MultiListDataClass { ParentListProperty = [new() { ListProperty = [new()] }] } }, inner.Take(2).ToArray(), new string[] { "Property" } }; 352yield return new object[] { new ArrayList { new MultiListDataClass { ParentListProperty = [new() { ListProperty = [new()] }] } }, inner.Take(3).ToArray(), Array.Empty<string>() };
TagHelpersWebSite (1)
TagHelpers\TagCloudViewComponentTagHelper.cs (1)
81return Tags.Take(count).ToArray();
Test.Utilities (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
Text.Analyzers (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
75return words.Take(1).Select(DecapitalizeFirstLetter).Concat(words.Skip(1).Select(CapitalizeFirstLetter)); 77return words.Take(1).Select(CapitalizeFirstLetter).Concat(words.Skip(1).Select(DecapitalizeFirstLetter));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (4)
91strippedTrivia = [.. leadingTriviaToKeep.Take(index)]; 140leadingTriviaToStrip = [.. leadingTrivia.Take(ppIndex + 1)]; 160leadingTriviaToStrip.AddRange(leadingTriviaToKeep.Take(index)); 180return [.. leadingTrivia.Take(index)];
xunit.assert (2)
Sdk\ArgumentFormatter.cs (2)
349 .Take(MAX_OBJECT_ITEM_COUNT + 1) 355 var formattedParameters = string.Join(", ", parameters.Take(MAX_OBJECT_ITEM_COUNT).Select(p => string.Format(CultureInfo.CurrentCulture, "{0} = {1}", p.name, p.value)));