35 references to LastOrDefault
Aspire.Dashboard (1)
Components\Controls\Chart\MetricTable.razor.cs (1)
121var previousMetric = newMetrics.LastOrDefault(dt => dt.Key < xValue).Value;
Microsoft.AspNetCore.Mvc.Core (1)
DependencyInjection\MvcCoreServiceCollectionExtensions.cs (1)
94.LastOrDefault(d => d.ServiceType == typeof(T))
Microsoft.CodeAnalysis.CodeStyle.Fixes (2)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
712var lastDirective = leadingTrivia.LastOrDefault(t => t.IsDirective);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start);
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
67var lastPragma = root.GetFirstToken().LeadingTrivia.LastOrDefault(t => t.Kind() is SyntaxKind.PragmaWarningDirectiveTrivia);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (9)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (4)
158=> members.LastOrDefault(m => m is FieldDeclarationSyntax); 161=> members.LastOrDefault(m => m is ConstructorDeclarationSyntax); 164=> members.LastOrDefault(m => m is MethodDeclarationSyntax); 167=> members.LastOrDefault(m => m is OperatorDeclarationSyntax or ConversionOperatorDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
596var lastEndIf = closeBraceTrivia.LastOrDefault(t => t.GetStructure() is EndIfDirectiveTriviaSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (1)
115var lastMember = destination.Members.LastOrDefault(m => m.EqualsValue != null);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (2)
31var lastEvent = members.LastOrDefault(m => m is EventFieldDeclarationSyntax); 39var lastEvent = members.LastOrDefault(m => m is EventDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
32var lastProperty = members.LastOrDefault(m => m is PropertyDeclarationSyntax);
Microsoft.CodeAnalysis.CSharp.Features (5)
ChangeSignature\CSharpChangeSignatureService.cs (2)
219var lastAttributes = matchingNode.ChildNodes().LastOrDefault(n => n is AttributeListSyntax); 229var parameterList = matchingNode.ChildNodes().LastOrDefault(n => n is ParameterListSyntax);
EditAndContinue\BreakpointSpans.cs (1)
308switchArm = switchExpression.Arms.LastOrDefault(arm => position >= arm.FullSpan.Start) ?? switchExpression.Arms.First();
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
488var precedingEndOfLine = nextStatementLeading.LastOrDefault(t => t.Kind() == SyntaxKind.EndOfLineTrivia);
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
67var lastPragma = root.GetFirstToken().LeadingTrivia.LastOrDefault(t => t.Kind() is SyntaxKind.PragmaWarningDirectiveTrivia);
Microsoft.CodeAnalysis.CSharp.Workspaces (9)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (4)
158=> members.LastOrDefault(m => m is FieldDeclarationSyntax); 161=> members.LastOrDefault(m => m is ConstructorDeclarationSyntax); 164=> members.LastOrDefault(m => m is MethodDeclarationSyntax); 167=> members.LastOrDefault(m => m is OperatorDeclarationSyntax or ConversionOperatorDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
596var lastEndIf = closeBraceTrivia.LastOrDefault(t => t.GetStructure() is EndIfDirectiveTriviaSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (1)
115var lastMember = destination.Members.LastOrDefault(m => m.EqualsValue != null);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (2)
31var lastEvent = members.LastOrDefault(m => m is EventFieldDeclarationSyntax); 39var lastEvent = members.LastOrDefault(m => m is EventDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
32var lastProperty = members.LastOrDefault(m => m is PropertyDeclarationSyntax);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Structure\AbstractSyntaxNodeStructureProviderTests.cs (1)
47var previousToken = root.DescendantNodesAndTokens(descendIntoTrivia: true).TakeWhile(nodeOrToken => nodeOrToken != node).LastOrDefault(nodeOrToken => nodeOrToken.IsToken).AsToken();
Microsoft.CodeAnalysis.Features (1)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
712var lastDirective = leadingTrivia.LastOrDefault(t => t.IsDirective);
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start);
Microsoft.DotNet.ArcadeLogging (2)
PipelinesLogger.cs (2)
245string propertyCategory = e.Properties?.Cast<DictionaryEntry>().LastOrDefault(p => p.Key.ToString().Equals(s_TelemetryMarker)).Value?.ToString(); 248propertyCategory = e.GlobalProperties?.LastOrDefault(p => p.Key.ToString().Equals($"_{s_TelemetryMarker}")).Value;
Microsoft.DotNet.Build.Tasks.Packaging (1)
PackageIndex.cs (1)
630var compatibleMapping = mappings.LastOrDefault(m => m.Key < normalizedFramework.Version);
System.Linq.Parallel (1)
System\Linq\ParallelEnumerable.cs (1)
5714.LastOrDefault(ExceptionAggregator.WrapFunc<TSource, bool>(predicate, settings.CancellationState));