Is Weekend - CSharp System

CSharp examples for System:DateTime Week

Description

Is Weekend

Demo Code

//      Copyright (c) 2014-2015 OSharp. All rights reserved.
using System.Linq;
using System;/*w ww. j a va2 s  .  c om*/

public class Main{
        public static bool IsWeekend(this DateTime dateTime)
        {
            DayOfWeek[] weeks = { DayOfWeek.Saturday, DayOfWeek.Sunday };
            return weeks.Contains(dateTime.DayOfWeek);
        }
}

Related Tutorials