Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
AnswerRe: Changing many projects from AnyCPU to x64 Pin
Richard MacCutchan25-Sep-19 21:43
mveRichard MacCutchan25-Sep-19 21:43 
GeneralRe: Changing many projects from AnyCPU to x64 Pin
Bernhard Hiller26-Sep-19 21:43
Bernhard Hiller26-Sep-19 21:43 
GeneralRe: Changing many projects from AnyCPU to x64 Pin
harold aptroot27-Sep-19 23:35
harold aptroot27-Sep-19 23:35 
GeneralRe: Changing many projects from AnyCPU to x64 Pin
Bernhard Hiller29-Sep-19 21:48
Bernhard Hiller29-Sep-19 21:48 
AnswerRe: Changing many projects from AnyCPU to x64 Pin
AntGamble15-Oct-19 21:40
AntGamble15-Oct-19 21:40 
QuestionHow to properly close a JSON Post using RestSharp? Pin
mlong3024-Sep-19 13:25
mlong3024-Sep-19 13:25 
AnswerRe: How to properly close a JSON Post using RestSharp? Pin
BillWoodruff24-Sep-19 16:06
professionalBillWoodruff24-Sep-19 16:06 
QuestionLINQ: Remove first entry of groups in a list Pin
Mc_Topaz23-Sep-19 3:20
Mc_Topaz23-Sep-19 3:20 
Well ,that title is confusing... Poke tongue | ;-P

I have this list:
C#
var list = new List<(int Key, string Value)>();
list.Add((1, "foo1"));
list.Add((1, "foo2"));
list.Add((1, "foo3"));
list.Add((1, "foo4"));
list.Add((2, "bar1"));
list.Add((2, "bar2"));
list.Add((2, "bar3"));
list.Add((2, "bar4"));
list.Add((3, "baz"));
From that list I want a new list:
C#
(1, "foo2")
(1, "foo3")
(1, "foo4")
(2, "bar2")
(2, "bar3")
(2, "bar4")

Notcie the first occurances of any "key/group" are removed in the result list.
These entries are removed: (1, "foo1"), (2, "bar1") and (3, "baz")

I have no clue how to do this. I have tried to create a solution, but I don't know how to find the first entry of a group and remove it using LINQ. The .Distinct() and .First() methods seems needed in someway, but I cannot figure it out. I'm sure I can hack something ugly with foreach loops and new lists, but I would prefer a solution with LINQ.

Any suggestions for a solution?
Best regards
AnswerRe: LINQ: Remove first entry of groups in a list Pin
OriginalGriff23-Sep-19 4:31
mveOriginalGriff23-Sep-19 4:31 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
Mc_Topaz23-Sep-19 4:49
Mc_Topaz23-Sep-19 4:49 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
OriginalGriff23-Sep-19 4:51
mveOriginalGriff23-Sep-19 4:51 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
BillWoodruff23-Sep-19 5:47
professionalBillWoodruff23-Sep-19 5:47 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
OriginalGriff23-Sep-19 5:50
mveOriginalGriff23-Sep-19 5:50 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
BillWoodruff23-Sep-19 5:55
professionalBillWoodruff23-Sep-19 5:55 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
OriginalGriff23-Sep-19 6:11
mveOriginalGriff23-Sep-19 6:11 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
BillWoodruff23-Sep-19 7:26
professionalBillWoodruff23-Sep-19 7:26 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
Luc Pattyn23-Sep-19 7:11
sitebuilderLuc Pattyn23-Sep-19 7:11 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
BillWoodruff23-Sep-19 7:18
professionalBillWoodruff23-Sep-19 7:18 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
Luc Pattyn23-Sep-19 7:26
sitebuilderLuc Pattyn23-Sep-19 7:26 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
OriginalGriff23-Sep-19 8:08
mveOriginalGriff23-Sep-19 8:08 
GeneralRe: LINQ: Remove first entry of groups in a list Pin
Luc Pattyn23-Sep-19 8:42
sitebuilderLuc Pattyn23-Sep-19 8:42 
QuestionHow to show UserControl(WPF) in a form project with not use ElementHost? Pin
Member 1308136922-Sep-19 13:59
Member 1308136922-Sep-19 13:59 
AnswerRe: How to show UserControl(WPF) in a form project with not use ElementHost? Pin
Dave Kreskowiak22-Sep-19 16:55
mveDave Kreskowiak22-Sep-19 16:55 
PraiseRe: How to show UserControl(WPF) in a form project with not use ElementHost? Pin
Member 1308136925-Sep-19 13:43
Member 1308136925-Sep-19 13:43 
AnswerRe: How to show UserControl(WPF) in a form project with not use ElementHost? Pin
Gerry Schmitz24-Sep-19 7:27
mveGerry Schmitz24-Sep-19 7:27 

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.