Click here to Skip to main content
15,913,773 members
Home / Discussions / C#
   

C#

 
QuestionVisual Studio Output to Run as Admin always Pin
Subin Mavunkal27-May-14 22:57
Subin Mavunkal27-May-14 22:57 
AnswerRe: Visual Studio Output to Run as Admin always Pin
Richard MacCutchan28-May-14 0:53
mveRichard MacCutchan28-May-14 0:53 
Questioncustom file properties Pin
jeffingeorge27-May-14 22:38
jeffingeorge27-May-14 22:38 
AnswerRe: custom file properties Pin
Chris Quinn27-May-14 22:48
Chris Quinn27-May-14 22:48 
AnswerRe: custom file properties Pin
Eddy Vluggen28-May-14 0:28
professionalEddy Vluggen28-May-14 0:28 
QuestionFile opertions Pin
jeffingeorge27-May-14 22:36
jeffingeorge27-May-14 22:36 
AnswerRe: File opertions Pin
Karen Mitchelle27-May-14 22:51
professionalKaren Mitchelle27-May-14 22:51 
AnswerRe: File opertions Pin
Eddy Vluggen28-May-14 0:28
professionalEddy Vluggen28-May-14 0:28 
Questionconvert string to system.linq.iqueryable in C# Pin
joji joseph27-May-14 22:08
joji joseph27-May-14 22:08 
AnswerRe: convert string to system.linq.iqueryable in C# Pin
Chris Quinn27-May-14 22:48
Chris Quinn27-May-14 22:48 
AnswerRe: convert string to system.linq.iqueryable in C# Pin
Dave Kreskowiak28-May-14 2:18
mveDave Kreskowiak28-May-14 2:18 
QuestionClone a printer & change default settings using C# Pin
Dazed.dnc27-May-14 19:03
Dazed.dnc27-May-14 19:03 
QuestionRe: Clone a printer & change default settings using C# Pin
Richard MacCutchan27-May-14 21:18
mveRichard MacCutchan27-May-14 21:18 
AnswerRe: Clone a printer & change default settings using C# Pin
Dazed.dnc28-May-14 13:02
Dazed.dnc28-May-14 13:02 
QuestionVariable Datasource Name Pin
eddieangel27-May-14 11:27
eddieangel27-May-14 11:27 
AnswerRe: Variable Datasource Name Pin
Gerry Schmitz27-May-14 12:10
mveGerry Schmitz27-May-14 12:10 
GeneralRe: Variable Datasource Name Pin
eddieangel27-May-14 12:13
eddieangel27-May-14 12:13 
GeneralRe: Variable Datasource Name Pin
Gerry Schmitz27-May-14 14:39
mveGerry Schmitz27-May-14 14:39 
GeneralRe: Variable Datasource Name Pin
eddieangel27-May-14 14:40
eddieangel27-May-14 14:40 
GeneralRe: Variable Datasource Name Pin
Gerry Schmitz27-May-14 14:55
mveGerry Schmitz27-May-14 14:55 
QuestionDayOfWeek/Date problem. Pin
Shady George27-May-14 10:58
Shady George27-May-14 10:58 
AnswerRe: DayOfWeek/Date problem. Pin
Gerry Schmitz27-May-14 11:55
mveGerry Schmitz27-May-14 11:55 
AnswerRe: DayOfWeek/Date problem. Pin
Pete O'Hanlon27-May-14 12:00
mvePete O'Hanlon27-May-14 12:00 
SuggestionRe: DayOfWeek/Date problem. Pin
Richard Deeming28-May-14 1:19
mveRichard Deeming28-May-14 1:19 
No need for a loop - just switch on the DayOfWeek:
C#
public DateTime FindSecondTuesday(int month, int year)
{
  DateTime date = new DateTime(year, month, 1);
  switch (date.DayOfWeek)
  {
    case DayOfWeek.Sunday:
    {
      return date.AddDays(9);
    }
    case DayOfWeek.Monday:
    {
      return date.AddDays(8);
    }
    case DayOfWeek.Tuesday:
    {
      return date.AddDays(7);
    }
    case DayOfWeek.Wednesday:
    {
      return date.AddDays(13);
    }
    case DayOfWeek.Thursday:
    {
      return date.AddDays(12);
    }
    case DayOfWeek.Friday:
    {
      return date.AddDays(11);
    }
    case DayOfWeek.Saturday:
    {
      return date.AddDays(10);
    }
    default:
    {
      throw new InvalidOperationException("Lousy Smarch weather!");
    }
  }
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


AnswerRe: DayOfWeek/Date problem. Pin
Mycroft Holmes27-May-14 12:51
professionalMycroft Holmes27-May-14 12:51 

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.