Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

return last row if all other condition fails in linq c#

Mains.GroupBy(l => l.ContactID)
.Select(g=>g.OrderByDescending(c=>c.ID).FirstOrDefault()) 
.ToList()
Comment

return last row if all other condition fails in linq c#

var grouped = Mains.GroupBy(l => l.ContactID);
var ids = grouped.Select(g => g.Max(x => x.Id));
var result = grouped.Where(g => ids.Contains(g.Id));
Comment

PREVIOUS NEXT
Code Example
Csharp :: Web API - Stream large file to client 
Csharp :: c# check if username and password is true 
Csharp :: php encrypt message encrypt() decrypt 
Csharp :: viewsheet location revit api 
Csharp :: c# get app FileVersion 
Csharp :: send to main args dotnet debug 
Csharp :: how to update modal class using dbfirst in asp.net core 
Csharp :: query to linq converter online 
Csharp :: how to make header in unity public variables 
Csharp :: c# unhandled exception in thread” 
Csharp :: Maximum Points You Can Obtain from Cards 
Csharp :: does Registry.CurrentUser.OpenSubKey create the key if it does not exist? 
Csharp :: c# extract after what is 
Csharp :: esaddex34 
Csharp :: c# how to group console output into columns 
Csharp :: spreate by captial char in c# 
Csharp :: c# project default namespace 
Csharp :: LAST ELEMT OF ARRAY 
Csharp :: unity use of possibly unassigned field struct 
Csharp :: aws asp.net tutorial 
Csharp :: C# if...else if Statement 
Csharp :: how to add logo in a unity game apk 
Csharp :: null objects 
Csharp :: c# initialize array of objects 
Csharp :: cannot access file being used by another process create file 
Csharp :: c# force arguments to be keywords 
Csharp :: c# int array add number 
Csharp :: list dictionary c# 
Csharp :: c# close all threads application exit 
Csharp :: freelance 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =