What would be a good/efficient data structure to hold a collection of when no order is needed?

Unfortunately, I didn't pay enough attention at uni during the lessons about data structures/complexity. I've basically just been using IEnumerable, List, Dictionary and arrays, but I think it's time to step it up and start thinking about efficiency.

I've got a class called PublicHolidayRule, and I basically need two data structures in there to define those rules. For example, one type of rule is that Christmas Day is always 25th of December, regardless of year. The other type of rule is for the public holidays that kind of float around, for example, the Queen's birthday here in Australia is always the second Monday of June.

So I was thinking I'd need two data structures:

  • int dayOfMonth, int monthOfYear (e.g. 25, 12 for Christmas)
  • DayOfWeek dayOfWeek, int occurrenceInMonth, int monthOfYear (e.g. Monday, 2, 6 for the Queen's birthday)

Any ideas on what structures to use? Thanks for your help!

by electricdandan via /r/csharp

Leave a Reply