public static List <MonthsOfYear> GetValues(this MonthsOfYear Flags)
        {
            var ret = new List <MonthsOfYear>(Order.Length);

            foreach (var item in Order)
            {
                if (Flags.HasFlag(item))
                {
                    ret.Add(item);
                }
            }

            return(ret);
        }
Beispiel #2
0
        private string getMonthOfYearDescription()
        {
            MonthsOfYear months = (MonthsOfYear)MonthsOfYearBitmask;

            if (months.HasFlag(MonthsOfYear.January))
            {
                return("Jan");
            }
            if (months.HasFlag(MonthsOfYear.February))
            {
                return("Feb");
            }
            if (months.HasFlag(MonthsOfYear.March))
            {
                return("Mar");
            }
            if (months.HasFlag(MonthsOfYear.April))
            {
                return("Apr");
            }
            if (months.HasFlag(MonthsOfYear.May))
            {
                return("May");
            }
            if (months.HasFlag(MonthsOfYear.June))
            {
                return("Jun");
            }
            if (months.HasFlag(MonthsOfYear.July))
            {
                return("Jul");
            }
            if (months.HasFlag(MonthsOfYear.August))
            {
                return("Aug");
            }
            if (months.HasFlag(MonthsOfYear.September))
            {
                return("Sep");
            }
            if (months.HasFlag(MonthsOfYear.October))
            {
                return("Oct");
            }
            if (months.HasFlag(MonthsOfYear.November))
            {
                return("Nov");
            }
            if (months.HasFlag(MonthsOfYear.December))
            {
                return("Dec");
            }

            return("");
        }
Beispiel #3
0
        private string getMonthsOfYearDescription()
        {
            string       monthsDesc = string.Empty;
            MonthsOfYear months     = (MonthsOfYear)MonthsOfYearBitmask;

            if (months.HasFlag(MonthsOfYear.January) &&
                months.HasFlag(MonthsOfYear.February) &&
                months.HasFlag(MonthsOfYear.March) &&
                months.HasFlag(MonthsOfYear.April) &&
                months.HasFlag(MonthsOfYear.May) &&
                months.HasFlag(MonthsOfYear.June) &&
                months.HasFlag(MonthsOfYear.July) &&
                months.HasFlag(MonthsOfYear.August) &&
                months.HasFlag(MonthsOfYear.September) &&
                months.HasFlag(MonthsOfYear.October) &&
                months.HasFlag(MonthsOfYear.November) &&
                months.HasFlag(MonthsOfYear.December))
            {
                monthsDesc = "every month";
                return(monthsDesc);
            }
            else
            {
                if (months.HasFlag(MonthsOfYear.January))
                {
                    monthsDesc += " Jan,";
                }
                if (months.HasFlag(MonthsOfYear.February))
                {
                    monthsDesc += " Feb,";
                }
                if (months.HasFlag(MonthsOfYear.March))
                {
                    monthsDesc += " Mar,";
                }
                if (months.HasFlag(MonthsOfYear.April))
                {
                    monthsDesc += " Apr,";
                }
                if (months.HasFlag(MonthsOfYear.May))
                {
                    monthsDesc += " May,";
                }
                if (months.HasFlag(MonthsOfYear.June))
                {
                    monthsDesc += " Jun,";
                }
                if (months.HasFlag(MonthsOfYear.July))
                {
                    monthsDesc += " Jul,";
                }
                if (months.HasFlag(MonthsOfYear.August))
                {
                    monthsDesc += " Aug,";
                }
                if (months.HasFlag(MonthsOfYear.September))
                {
                    monthsDesc += " Sep,";
                }
                if (months.HasFlag(MonthsOfYear.October))
                {
                    monthsDesc += " Oct,";
                }
                if (months.HasFlag(MonthsOfYear.November))
                {
                    monthsDesc += " Nov,";
                }
                if (months.HasFlag(MonthsOfYear.December))
                {
                    monthsDesc += " Dec,";
                }
            }

            // remove leading space and trailing comma
            return(monthsDesc.Trim().Substring(0, monthsDesc.Length - 2));
        }