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

C#

 
GeneralRe: DAL Exception Handling Pin
Pete O'Hanlon18-Nov-19 4:43
mvePete O'Hanlon18-Nov-19 4:43 
AnswerRe: DAL Exception Handling Pin
Gerry Schmitz15-Nov-19 5:21
mveGerry Schmitz15-Nov-19 5:21 
GeneralRe: DAL Exception Handling Pin
Kevin Marois15-Nov-19 5:59
professionalKevin Marois15-Nov-19 5:59 
GeneralRe: DAL Exception Handling Pin
Gerry Schmitz16-Nov-19 2:45
mveGerry Schmitz16-Nov-19 2:45 
SuggestionRe: DAL Exception Handling Pin
Richard Deeming15-Nov-19 5:29
mveRichard Deeming15-Nov-19 5:29 
GeneralRe: DAL Exception Handling Pin
Kevin Marois15-Nov-19 5:55
professionalKevin Marois15-Nov-19 5:55 
GeneralRe: DAL Exception Handling Pin
Richard Deeming15-Nov-19 6:43
mveRichard Deeming15-Nov-19 6:43 
QuestionLINQ sort and group dates by month and day, ignore year Pin
Mc_Topaz15-Nov-19 0:38
Mc_Topaz15-Nov-19 0:38 
I have this setup of a list containing dates and strings:
C#
var d0 = new DateTime(2019, 10, 20);
var d1 = new DateTime(2018, 10, 20);
var d2 = new DateTime(2019, 10, 21);
var d3 = new DateTime(2019, 10, 20);
var d4 = new DateTime(2017, 10, 21);
var d5 = new DateTime(2013, 10, 22);
var d6 = new DateTime(2015, 10, 21);
var d7 = new DateTime(2010, 10, 23);
var d8 = new DateTime(1995, 10, 20);
var d9 = new DateTime(2019, 10, 22);

var list = new List<(DateTime Date, string Name)>();
list.Add((d0, "D0"));
list.Add((d1, "D1"));
list.Add((d2, "D2"));
list.Add((d3, "D3"));
list.Add((d4, "D4"));
list.Add((d5, "D5"));
list.Add((d6, "D6"));
list.Add((d7, "D7"));
list.Add((d8, "D8"));
list.Add((d9, "D9"));
I want to use LINQ to transform the list in the following order:
C#
(2019-10-20, "D0")
(2018-10-20, "D1")
(2019-10-20, "D3")
(1995-10-20, "D8")
(2019-10-21, "D2")
(2017-10-21, "D4")
(2015-10-21, "D6")
(2013-10-22, "D5")
(2019-10-22, "D9")
(2010-10-23, "D7")
Notice the month and day decides the order, not the year.

I have tried to mess around with LINQ's GroupBy() method, but cannot understand how to group dates where months and days are equal.

Also there is a sorting rule:
Notice the "D0"-item comes before the "D1"-item, even if the "D1"-item has year set to 2018 and the "D0"-item has year set to 2019.
AnswerRe: LINQ sort and group dates by month and day, ignore year Pin
Richard Deeming15-Nov-19 1:28
mveRichard Deeming15-Nov-19 1:28 
GeneralRe: LINQ sort and group dates by month and day, ignore year Pin
Mc_Topaz15-Nov-19 2:38
Mc_Topaz15-Nov-19 2:38 
QuestionDispose a Tooltip Pin
ConnerMcLoud15-Nov-19 0:32
ConnerMcLoud15-Nov-19 0:32 
AnswerRe: Dispose a Tooltip Pin
OriginalGriff15-Nov-19 2:25
mveOriginalGriff15-Nov-19 2:25 
AnswerRe: Dispose a Tooltip Pin
Gerry Schmitz15-Nov-19 5:41
mveGerry Schmitz15-Nov-19 5:41 
AnswerRe: Dispose a Tooltip Pin
Luc Pattyn15-Nov-19 6:22
sitebuilderLuc Pattyn15-Nov-19 6:22 
QuestionType Overflow... Pin
Bernhard Hiller15-Nov-19 0:02
Bernhard Hiller15-Nov-19 0:02 
AnswerRe: Type Overflow... Pin
phil.o15-Nov-19 0:46
professionalphil.o15-Nov-19 0:46 
GeneralRe: Type Overflow... Pin
Bernhard Hiller15-Nov-19 0:49
Bernhard Hiller15-Nov-19 0:49 
AnswerRe: Type Overflow... Pin
Richard Deeming15-Nov-19 1:20
mveRichard Deeming15-Nov-19 1:20 
GeneralRe: Type Overflow... Pin
Bernhard Hiller15-Nov-19 4:55
Bernhard Hiller15-Nov-19 4:55 
QuestionAdding panels dynamically through user input Pin
jacko112313-Nov-19 1:34
jacko112313-Nov-19 1:34 
AnswerRe: Adding panels dynamically through user input Pin
OriginalGriff13-Nov-19 1:45
mveOriginalGriff13-Nov-19 1:45 
GeneralRe: Adding panels dynamically through user input Pin
jacko112313-Nov-19 2:20
jacko112313-Nov-19 2:20 
SuggestionRe: Adding panels dynamically through user input Pin
Richard Deeming13-Nov-19 1:58
mveRichard Deeming13-Nov-19 1:58 
GeneralRe: Adding panels dynamically through user input Pin
jacko112313-Nov-19 2:19
jacko112313-Nov-19 2:19 
AnswerRe: Adding panels dynamically through user input Pin
Luc Pattyn13-Nov-19 3:12
sitebuilderLuc Pattyn13-Nov-19 3:12 

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.