C Sharp: İstenilen tarihin yılın kaçıncı haftası olduğunu gösteren metot


İstenilen tarihin yılın kaçıncı haftası olduğunu bulmak için aşağıdaki metot kullanılabilir. Framework içindeki Datetime sınıfında olmayan ancak işinize yarayabilecek bir metottur.


public int GetWeekNumber(DateTime dtPassed)
{
 CultureInfo ciCurr = CultureInfo.CurrentCulture;
 int weekNum = ciCurr.Calendar.GetWeekOfYear(dtPassed, CalendarWeekRule.FirstFourDayWeek,      DayOfWeek.Monday);
 return weekNum;

}


Kullanımı:
int hafta = GetWeekNumber(DateTime.Now);  // 08.05.2014
//hafta= 19 olacaktır 



BlackListIP control on Serenity platform (.NET Core)

 In the Serenity platform, if you want to block IPs that belong to people you do not want to come from outside in the .net core web project,...