I just found a solution, maybe not the most effective one. I built from the response of @ RaulAlmeira.
var listaDatas = new List<DateTime>(); //Lista que vai receber as datas
1st - I created a list for each week of the month
listaDatasPrimeiraSemana = new List<DateTime>();
listaDatasSegundaSemana = new List<DateTime>();
listaDatasTerceiraSemana = new List<DateTime>();
listaDatasQuartaSemana = new List<DateTime>();
listaDatasQuintaSemana = new List<DateTime>();
2º- I started a date beginning on the 1st of January
DateTime date = DateTime(2014, 1, 1);
3º- I filled the lists of weeks, running the five weeks to fill every day in the respective lists
while (numSemana <= 5) //Enquanto a semana for menor de 5 continua a percorrer
{
DateTime tempdate = data.AddDays(-data.Day + 1);
CultureInfo ciCurr = CultureInfo.CurrentCulture;
int weekNumStart = ciCurr.Calendar.GetWeekOfYear(tempdate, CalendarWeekRule.FirstFourDayWeek, ciCurr.DateTimeFormat.FirstDayOfWeek);
int weekNum = ciCurr.Calendar.GetWeekOfYear(data, CalendarWeekRule.FirstFourDayWeek, ciCurr.DateTimeFormat.FirstDayOfWeek);
numSemana = weekNum - weekNumStart + 1;
if (data.AddDays(1).Month != data.Month) { break; }
if (numSemana == 1)
{
listaDatasPrimeiraSemana.Add(data);
}
if (numSemana == 2)
{
listaDatasSegundaSemana.Add(data);
}
if (numSemana == 3)
{
listaDatasTerceiraSemana.Add(data);
}
if (numSemana == 4)
{
listaDatasQuartaSemana.Add(data);
}
if (numSemana == 5)
{
listaDatasQuintaSemana.Add(data);
}
data = data.AddDays(1);
}
4th - I was able to see what week the user chose
if (servico.SemanaMensalPeriod == "Primeira") //servico.SemanaMensalPeriod contém a semana escolhida pelo utilizador
{
foreach (var item in listaDatasPrimeiraSemana)//Percorro a primeira semana
{
if (item.DayOfWeek == DayOfWeek.Monday) { listaDatas.Add(item); } //Verifico se na semana há alguma segunda feira, e caso exista adiciono à lista de datas
}
}
...
Condição if igual à de cima para verificar se tenho alguma segunda-feira nas restantes semanas
...
ATTENTION
The code above only shows the result for the month of January, to do for a period of time or for the whole year just put the code on top of a for loop and go iterating the month (it was like I did, but I did not find it necessary to post).
I know this is by far the most effective solution and I know it, I just leave here how I solved the problem. Although I've seen better solutions here than mine