Click here to Skip to main content
15,893,814 members
Home / Discussions / C#
   

C#

 
GeneralRe: Linq TO SQL DistinctBy Question Pin
Richard Deeming23-Jun-22 22:36
mveRichard Deeming23-Jun-22 22:36 
Not quite. An anonymous type uses value equality, not reference equality:
Because the Equals and GetHashCode methods on anonymous types are defined in terms of the Equals and GetHashCode methods of the properties, two instances of the same anonymous type are equal only if all their properties are equal.

Also, the DistinctBy operator which was added in .NET 6 uses a different approach from the blog you linked to:
runtime/Distinct.cs at ebba1d4acb7abea5ba15e1f7f69d1d1311465d16 · dotnet/runtime · GitHub[^]

And the answer will also depend on whether the DistinctBy method gets translated to SQL, or evaluated on the client.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

AnswerRe: Linq TO SQL DistinctBy Question Pin
Richard Deeming23-Jun-22 22:43
mveRichard Deeming23-Jun-22 22:43 
QuestionDrawing with c# Pin
Member 1557095222-Jun-22 23:08
Member 1557095222-Jun-22 23:08 
AnswerRe: Drawing with c# Pin
Richard Deeming22-Jun-22 23:55
mveRichard Deeming22-Jun-22 23:55 
GeneralRe: Drawing with c# Pin
Member 1557095223-Jun-22 0:08
Member 1557095223-Jun-22 0:08 
GeneralRe: Drawing with c# Pin
Richard Deeming23-Jun-22 0:42
mveRichard Deeming23-Jun-22 0:42 
AnswerRe: Drawing with c# Pin
Gerry Schmitz23-Jun-22 3:09
mveGerry Schmitz23-Jun-22 3:09 
AnswerRe: Drawing with c# Pin
OriginalGriff23-Jun-22 3:59
mveOriginalGriff23-Jun-22 3:59 
AnswerRe: Drawing with c# Pin
Member 1557095223-Jun-22 21:16
Member 1557095223-Jun-22 21:16 
GeneralRe: Drawing with c# Pin
Richard Deeming23-Jun-22 22:24
mveRichard Deeming23-Jun-22 22:24 
GeneralRe: Drawing with c# Pin
Member 1557095223-Jun-22 23:20
Member 1557095223-Jun-22 23:20 
GeneralRe: Drawing with c# Pin
Victor Nijegorodov24-Jun-22 5:54
Victor Nijegorodov24-Jun-22 5:54 
GeneralRe: Drawing with c# Pin
Dave Kreskowiak24-Jun-22 5:58
mveDave Kreskowiak24-Jun-22 5:58 
GeneralMessage Closed Pin
24-Jun-22 15:28
professionalKevin Marois24-Jun-22 15:28 
GeneralRe: Drawing with c# Pin
trønderen24-Jun-22 17:02
trønderen24-Jun-22 17:02 
QuestionSimple Paint app in winforms Pin
Aafaan_Jii20-Jun-22 23:19
Aafaan_Jii20-Jun-22 23:19 
AnswerRe: Simple Paint app in winforms Pin
OriginalGriff20-Jun-22 23:40
mveOriginalGriff20-Jun-22 23:40 
AnswerRe: Simple Paint app in winforms Pin
Pete O'Hanlon21-Jun-22 2:18
mvePete O'Hanlon21-Jun-22 2:18 
AnswerRe: Simple Paint app in winforms Pin
Dave Kreskowiak21-Jun-22 4:39
mveDave Kreskowiak21-Jun-22 4:39 
AnswerRe: Simple Paint app in winforms Pin
Gerry Schmitz21-Jun-22 4:45
mveGerry Schmitz21-Jun-22 4:45 
QuestionHTML Input Controls Value Pin
Member 1431490219-Jun-22 18:46
Member 1431490219-Jun-22 18:46 
AnswerRe: HTML Input Controls Value Pin
OriginalGriff19-Jun-22 19:32
mveOriginalGriff19-Jun-22 19:32 
GeneralRe: HTML Input Controls Value Pin
Member 1431490219-Jun-22 19:47
Member 1431490219-Jun-22 19:47 
GeneralRe: HTML Input Controls Value Pin
Richard Deeming19-Jun-22 21:38
mveRichard Deeming19-Jun-22 21:38 
GeneralRe: HTML Input Controls Value Pin
OriginalGriff19-Jun-22 21:51
mveOriginalGriff19-Jun-22 21:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.