`
joerong666
  • 浏览: 418349 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

获取有效工作日封装类

    博客分类:
  • c#
阅读更多

获取有效工作日封装类

http://www.sina.com.cn 2008年06月25日 16:36  IT168.com
<!----><!----><!---->
【IT168技术文档】

  在做项目的时候要求得到该月的有效工作日,于是开始写静态方法,后来由于还要获取当月开始到现在的有效工作日,于是再写方法,最后因为以后的项目还要用于是继续扩展,直接封装出一个类来。
using System;
using System.Collections.Generic;
using System.Text;
namespace MyCom.Util.Time
{
    /// <summary>
    /// 获取有效工作日
    /// </summary>
    public class WorkDateProvider
    {
        #region 静态方法段
        /// <summary>
        /// 在一段内获取有效工作日
        /// </summary>
        /// <param name="dt1">开始日期</param>
        /// <param name="dt2">结束日期</param>
        /// <param name="intNoContain">不包含日期数</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateBy2Date(DateTime dt1, DateTime dt2, int intNoContain)
        {
            //判断不包含天数是否合法
            if (intNoContain <= 0)
                throw (new Exception("不包含天数必须大于0"));
            return GetWorkDateBy2Date(dt1, dt2) - intNoContain;
        }
        /// <summary>
        /// 在一段内获取有效工作日
        /// </summary>
        /// <param name="dt1">开始日期</param>
        /// <param name="dt2">结束日期</param>
        /// <param name="intNoContain">不包含日期数</param>
        /// <param name="intContain">包含日期数</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateBy2Date(DateTime dt1, DateTime dt2, int intNoContain, int intContain)
        {
            if (intContain <= 0)
                throw (new Exception("包含天数必须大于0"));
            return GetWorkDateBy2Date(dt1, dt2, intNoContain) + intContain;
        }
        /// <summary>
        /// 在一段内获取有效工作日
        /// </summary>
        /// <param name="dt1">开始日期</param>
        /// <param name="dt2">结束日期</param>
        /// <param name="strarrNoContain">不包含日期列表</param>
        /// <param name="strarrContain">包含日期列表</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateBy2Date(DateTime dt1, DateTime dt2, string[] strarrNoContain, string[] strarrContain)
        {
            int intContain = 0;
            foreach (string strContain in strarrContain)
            {
                try
                {
                    DateTime dtDuring = DateTime.Parse(strContain);
                    if (dt1 <= dtDuring && dtDuring <= dt2)
                        switch (dtDuring.DayOfWeek) //判断是否本来不是工作日的日期
                        {
                            case DayOfWeek.Saturday:
                            case DayOfWeek.Sunday:
                                intContain++;
                                break;
                            default:
                                break;
                        }
                }
                catch (Exception ex)
                {
                    throw (ex);
                }
            }
            return GetWorkDateBy2Date(dt1, dt2, strarrNoContain) + intContain;
        }
        /// <summary>
        /// 在一段内获取有效工作日
        /// </summary>
        /// <param name="dt1">开始日期</param>
        /// <param name="dt2">结束日期</param>
        /// <param name="strarrNoContain">不包含日期列表</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateBy2Date(DateTime dt1, DateTime dt2, string[] strarrNoContain)
        {
            int intNotContain = 0;
            foreach (string strNoContain in strarrNoContain)
            {
                try
                {
                    DateTime dtDuring = DateTime.Parse(strNoContain);
                    if (dt1 <= dtDuring && dtDuring <= dt2)
                    {
                        switch (dtDuring.DayOfWeek)//判断原来是工作日
                        {
                            case DayOfWeek.Monday:
                            case DayOfWeek.Tuesday:
                            case DayOfWeek.Wednesday:
                            case DayOfWeek.Thursday:
                            case DayOfWeek.Friday:
                                intNotContain++;
                                break;
                            default:
                                break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw (ex);
                }
            }
            return GetWorkDateBy2Date(dt1, dt2, intNotContain);
        }
        /// <summary>
        /// 在一段内获取有效工作日
        /// </summary>
        /// <param name="dt1">开始日期</param>
        /// <param name="dt2">结束日期</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateBy2Date(DateTime dt1, DateTime dt2)
        {
            if (dt1 > dt2)
                throw (new Exception("开始日期必须大于结束日期"));
            int intTotalDays = 0;
            for (DateTime dtDuring = dt1; dtDuring <= dt2; dtDuring = dtDuring.AddDays(1))
            {
                switch (dtDuring.DayOfWeek)//判断是否为工作日
                {
                    case DayOfWeek.Monday:
                    case DayOfWeek.Tuesday:
                    case DayOfWeek.Wednesday:
                    case DayOfWeek.Thursday:
                    case DayOfWeek.Friday:
                        intTotalDays++;
                        break;
                    case DayOfWeek.Saturday:
                    case DayOfWeek.Sunday:
                        break;
                }
            }
            return intTotalDays;
        }
        /// <summary>
        /// 获取制定年月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        /// <param name="intYear">年份</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByMonthAndYear(int intMonth, int intYear)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", intYear, intMonth));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", intYear, intMonth, System.DateTime.DaysInMonth(intYear, intMonth)));
            return GetWorkDateBy2Date(dt1, dt2);
        }
        /// <summary>
        /// 获取制定年月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        /// <param name="intYear">年份</param>
        /// <param name="intNoContain">不包含日期数</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByMonthAndYear(int intMonth, int intYear, int intNoContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", intYear, intMonth));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", intYear, intMonth, System.DateTime.DaysInMonth(intYear, intMonth)));
            return GetWorkDateBy2Date(dt1, dt2, intNoContain);
        }
        /// <summary>
        /// 获取制定年月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        /// <param name="intYear">年份</param>
        /// <param name="intNoContain">不包含日期数</param>
        /// <param name="intContain">包含日期数</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByMonthAndYear(int intMonth, int intYear, int intNoContain, int intContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", intYear, intMonth));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", intYear, intMonth, System.DateTime.DaysInMonth(intYear, intMonth)));
            return GetWorkDateBy2Date(dt1, dt2, intNoContain, intContain);
        }
        /// <summary>
        /// 获取制定年月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        /// <param name="intYear">年份</param>
        /// <param name="strarrNoContain">不包含日期列表</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByMonthAndYear(int intMonth, int intYear, string[] strarrNoContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", intYear, intMonth));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", intYear, intMonth, System.DateTime.DaysInMonth(intYear, intMonth)));
            return GetWorkDateBy2Date(dt1, dt2, strarrNoContain);
        }
        /// <summary>
        /// 获取制定年月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        /// <param name="intYear">年份</param>
        /// <param name="strarrNoContain">不包含日期列表</param>
        /// <param name="strarrContain">包含日期列表</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByMonthAndYear(int intMonth, int intYear, string[] strarrNoContain, string[] strarrContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", intYear, intMonth));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", intYear, intMonth, System.DateTime.DaysInMonth(intYear, intMonth)));
            return GetWorkDateBy2Date(dt1, dt2, strarrNoContain, strarrContain);
        }
        /// <summary>
        /// 获取本年制定月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByMonthThisYear(int intMonth)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", DateTime.Now.Date.Year, intMonth));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", DateTime.Now.Date.Year, intMonth, System.DateTime.DaysInMonth(DateTime.Now.Date.Year, intMonth)));
            return GetWorkDateBy2Date(dt1, dt2);
        }
        /// <summary>
        /// 获取本年制定月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        /// <param name="intNoContain">不包含日期数</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByMonthThisYear(int intMonth, int intNoContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", DateTime.Now.Date.Year, intMonth));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", DateTime.Now.Date.Year, intMonth, System.DateTime.DaysInMonth(DateTime.Now.Date.Year, intMonth)));
            return GetWorkDateBy2Date(dt1, dt2, intNoContain);
        }
        /// <summary>
        /// 获取本年制定月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        /// <param name="intNoContain">不包含日期数</param>
        /// <param name="intContain">包含日期数</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByMonthThisYear(int intMonth, int intNoContain, int intContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", DateTime.Now.Date.Year, intMonth));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", DateTime.Now.Date.Year, intMonth, System.DateTime.DaysInMonth(DateTime.Now.Date.Year, intMonth)));
            return GetWorkDateBy2Date(dt1, dt2, intNoContain, intContain);
        }
        /// <summary>
        /// 获取本年制定月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        /// <param name="strarrNoContain">不包含日期列表</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByMonthThisYear(int intMonth, string[] strarrNoContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", DateTime.Now.Date.Year, intMonth));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", DateTime.Now.Date.Year, intMonth, System.DateTime.DaysInMonth(DateTime.Now.Date.Year, intMonth)));
            return GetWorkDateBy2Date(dt1, dt2, strarrNoContain);
        }
        /// <summary>
        /// 获取本年制定月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        /// <param name="strarrNoContain">不包含日期列表</param>
        /// <param name="strarrContain">包含日期列表</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByMonthThisYear(int intMonth, string[] strarrNoContain, string[] strarrContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", DateTime.Now.Date.Year, intMonth));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", DateTime.Now.Date.Year, intMonth, System.DateTime.DaysInMonth(DateTime.Now.Date.Year, intMonth)));
            return GetWorkDateBy2Date(dt1, dt2, strarrNoContain, strarrContain);
        }
        /// <summary>
        /// 获取本年本月的有效工作日
        /// </summary>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByThisMonthThisYear()
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", DateTime.Now.Date.Year, DateTime.Now.Date.Month));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", DateTime.Now.Date.Year, DateTime.Now.Date.Month, System.DateTime.DaysInMonth(DateTime.Now.Date.Year, DateTime.Now.Date.Month)));
            return GetWorkDateBy2Date(dt1, dt2);
        }
        /// <summary>
        /// 获取本年本月的有效工作日
        /// </summary>
        /// <param name="intNoContain">不包含日期数</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByThisMonthThisYear(int intNoContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", DateTime.Now.Date.Year, DateTime.Now.Date.Month));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", DateTime.Now.Date.Year, DateTime.Now.Date.Month, System.DateTime.DaysInMonth(DateTime.Now.Date.Year, DateTime.Now.Date.Month)));
            return GetWorkDateBy2Date(dt1, dt2, intNoContain);
        }
        /// <summary>
        /// 获取本年本月的有效工作日
        /// </summary>
        /// <param name="intNoContain">不包含日期数</param>
        /// <param name="intContain">包含日期数</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByThisMonthThisYear(int intNoContain, int intContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", DateTime.Now.Date.Year, DateTime.Now.Date.Month));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", DateTime.Now.Date.Year, DateTime.Now.Date.Month, System.DateTime.DaysInMonth(DateTime.Now.Date.Year, DateTime.Now.Date.Month)));
            return GetWorkDateBy2Date(dt1, dt2, intNoContain, intContain);
        }
        /// <summary>
        /// 获取本年本月的有效工作日
        /// </summary>
        /// <param name="strarrNoContain">不包含日期列表</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByThisMonthThisYear(string[] strarrNoContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", DateTime.Now.Date.Year, DateTime.Now.Date.Month));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", DateTime.Now.Date.Year, DateTime.Now.Date.Month, System.DateTime.DaysInMonth(DateTime.Now.Date.Year, DateTime.Now.Date.Month)));
            return GetWorkDateBy2Date(dt1, dt2, strarrNoContain);
        }
        /// <summary>
        /// 获取本年本月的有效工作日
        /// </summary>
        /// <param name="strarrNoContain">不包含日期列表</param>
        /// <param name="strarrContain">包含日期列表</param>
        /// <returns>有效工作日数</returns>
        public static int GetWorkDateByThisMonthThisYear(string[] strarrNoContain, string[] strarrContain)
        {
            DateTime dt1 = DateTime.Parse(string.Format("{0}-{1}-01", DateTime.Now.Date.Year, DateTime.Now.Date.Month));
            DateTime dt2 = DateTime.Parse(string.Format("{0}-{1}-{2}", DateTime.Now.Date.Year, DateTime.Now.Date.Month, System.DateTime.DaysInMonth(DateTime.Now.Date.Year, DateTime.Now.Date.Month)));
            return GetWorkDateBy2Date(dt1, dt2, strarrNoContain, strarrContain);
        }
        #endregion
        #region 内部变量
        protected int _WorkDateYear = DateTime.Now.Year;
        protected int _WorkDateMonth = DateTime.Now.Month;
        protected string[] _NoContainDays = null;
        protected string[] _ContainDays = null;
        protected DateTime _WorkDateStart = DateTime.Now;
        protected DateTime _WorkDateEnd = DateTime.Now;
        protected GetDaysType _GetDaysType = GetDaysType.ByMonthAndYear;
        #endregion
        #region 属性
        /// <summary>
        /// 制定年份
        /// </summary>
        public int WorkDateYear
        {
            set
            {
                _WorkDateYear = value;
            }
            get
            {
                return _WorkDateYear;
            }
        }
        /// <summary>
        /// 制定月份
        /// </summary>
        public int WorkDateMonth
        {
            set
            {
                _WorkDateMonth = value;
            }
            get
            {
                return _WorkDateMonth;
            }
        }
        /// <summary>
        /// 不包含日期
        /// </summary>
        public string[] NoContainDays
        {
            set
            {
                _NoContainDays = value;
            }
            get
            {
                return _NoContainDays;
            }
        }
        /// <summary>
        /// 包含日期
        /// </summary>
        public string[] ContainDays
        {
            set
            {
                _ContainDays = value;
            }
            get
            {
                return _ContainDays;
            }
        }
        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime WorkDateStart
        {
            set
            {
                _WorkDateStart = value;
            }
            get
            {
                return _WorkDateStart;
            }
        }
        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime WorkDateEnd
        {
            set
            {
                _WorkDateEnd = value;
            }
            get
            {
                return _WorkDateEnd;
            }
        }
        /// <summary>
        /// 获取工作日类型
        /// </summary>
        public GetDaysType EmunGetDaysType
        {
            set
            {
                _GetDaysType = value;
            }
            get
            {
                return _GetDaysType;
            }
        }
        #endregion
        #region 调用枚举
        /// <summary>
        /// 获取工作日类型枚举
        /// </summary>
        public enum GetDaysType
        {
            ByDateStartAndEnd,
            ByMonthAndYear
        }
        #endregion
        #region 实例构造函数
        /// <summary>
        /// 默认本年本月获取有效工作日
        /// </summary>
        public WorkDateProvider()
        {
            EmunGetDaysType = GetDaysType.ByMonthAndYear;
        }
        /// <summary>
        /// 设定开始日期和结束日期获取有效工作日
        /// </summary>
        /// <param name="dt1">开始日期</param>
        /// <param name="dt2">结束日期</param>
        public WorkDateProvider(DateTime dt1, DateTime dt2)
        {
            WorkDateStart = dt1;
            WorkDateEnd = dt2;
            EmunGetDaysType = GetDaysType.ByDateStartAndEnd;
        }
        /// <summary>
        /// 设定本年指定月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        public WorkDateProvider(int intMonth)
        {
            WorkDateMonth = intMonth;
            EmunGetDaysType = GetDaysType.ByMonthAndYear;
        }
        /// <summary>
        /// 设定指定年月的有效工作日
        /// </summary>
        /// <param name="intMonth">月份</param>
        /// <param name="intYear">年份</param>
        public WorkDateProvider(int intMonth, int intYear)
        {
            WorkDateMonth = intMonth;
            WorkDateYear = intYear;
            EmunGetDaysType = GetDaysType.ByMonthAndYear;
        }
        #endregion
        #region 实例方法段
        /// <summary>
        /// 获取有效时间
        /// </summary>
        /// <returns>有效工作日数</returns>
        public int GetWorkDays()
        {
            return GetWorkDays(EmunGetDaysType);
        }
        /// <summary>
        /// 获取有效时间
        /// </summary>
        /// <param name="getDaysType">获取时间类型</param>
        /// <returns>有效工作日数</returns>
        public int GetWorkDays(GetDaysType getDaysType)
        {
            if (getDaysType == GetDaysType.ByDateStartAndEnd)
                return GetWorkDayByDateStartAndEnd();
            else
                return GetWorkDayByYearAndMonth();
        }
        /// <summary>
        /// 获取制定年月的有效工作日
        /// </summary>
        /// <returns>有效工作日数</returns>
        private int GetWorkDayByYearAndMonth()
        {
            WorkDateStart = DateTime.Parse(string.Format("{0}-{1}-01", WorkDateYear, WorkDateMonth));
            WorkDateEnd = DateTime.Parse(string.Format("{0}-{1}-{2}", WorkDateYear, WorkDateMonth, DateTime.DaysInMonth(WorkDateYear, WorkDateMonth)));
            return GetWorkDayByDateStartAndEnd();
        }
        /// <summary>
        /// 获取开始日期到结束日期之间的有效工作日
        /// </summary>
        /// <returns>有效工作日数</returns>
        protected int GetWorkDayByDateStartAndEnd()
        {
            //判断时间有效性          
            if (WorkDateStart > WorkDateEnd)
                throw (new Exception("开始日期大于结束日期"));
            int intNoContainDays = 0;
            int intContainDays = 0;
            int intTotalDays = 0;
            //计算不包含日期数
            if (NoContainDays != null)
                foreach (string strNoContain in NoContainDays)
                {
                    DateTime dtDuring = DateTime.Parse(strNoContain);
                    if (WorkDateStart <= dtDuring && dtDuring <= WorkDateEnd)
                    {
                        switch (dtDuring.DayOfWeek)
                        {
                            case DayOfWeek.Monday:
                            case DayOfWeek.Tuesday:
                            case DayOfWeek.Wednesday:
                            case DayOfWeek.Thursday:
                            case DayOfWeek.Friday:
                                intNoContainDays++;
                                break;
                            default:
                                break;
                        }
                    }
                }
            //计算包含日期数
            if (ContainDays != null)
                foreach (string strContain in ContainDays)
                {
                    DateTime dtDuring = DateTime.Parse(strContain);
                    if (WorkDateStart <= dtDuring && dtDuring <= WorkDateEnd)
                    {
                        switch (dtDuring.DayOfWeek)
                        {
                            case DayOfWeek.Saturday:
                            case DayOfWeek.Sunday:
                                intContainDays++;
                                break;
                            default:
                                break;
                        }
                    }
                }
            //计算常规日期数
            for (DateTime dtDuring = WorkDateStart; dtDuring <= WorkDateEnd; dtDuring = dtDuring.AddDays(1))
            {
                switch (dtDuring.DayOfWeek)
                {
                    case DayOfWeek.Monday:
                    case DayOfWeek.Tuesday:
                    case DayOfWeek.Wednesday:
                    case DayOfWeek.Thursday:
                    case DayOfWeek.Friday:
                        intTotalDays++;
                        break;
                    default:
                        break;
                }
            }
            return intTotalDays - intNoContainDays + intContainDays;
        }
        #endregion
    }
}
分享到:
评论

相关推荐

    iOS工具类封装

    这个工具类可能已经封装了这些复杂逻辑,使得开发者能快速得到高度信息,简化了布局工作。 然后,"获取今天的日期:年月日"涉及到了日期和时间的处理。在iOS中,我们可以使用`Date`对象和`Calendar`类来获取当前...

    获取ntp时间的客户端类

    在IT领域,网络时间协议(Network ...通过理解NTP协议的工作原理以及客户端类的设计和实现,开发者可以有效地创建自己的NTP客户端,从而确保网络中的时间一致性,这对于许多分布式系统和时间敏感的应用程序至关重要。

    企业工作日志管理系统

    同时,系统会监测所选时间的有效性,比如检查是否超出当前时间,或者是否符合工作日和工作时间的规定,以确保日志记录的准确性。 为了实现这些功能,开发者可能使用了如ASP.NET、Java EE等服务器端技术来构建后端...

    java utils 工具类

    10. **处理业务逻辑中的日期时间**:比如工作日计算、节假日判断等。 `DateTimeHelper.java`的源码分析可以帮助我们更好地理解如何使用这些功能,以及如何优化日期时间处理的代码。源码中可能使用了上述的一些或...

    论基于构件的软件开发.docx

    基于构件的软件开发技术是软件危机问题日益突出形势下的产物,它有效地解决了软件系统复杂度、成本、质量、效率等难以控制的问题。当前主流的软件构件技术有三大流派,分别是 OMG 的 CORBA、SUN 的 EJB 和微软的 ...

    TProxyGet.rar_TProxyGet_proxy delphi_proxy server_代理

    在源码中,我们可以看到Delphi的面向对象特性被充分利用,通过自定义的类结构,封装了代理服务器的获取、验证、管理等过程。其中,"TProxyGet"类很可能是主控件类,包含了获取代理、处理代理列表、验证代理有效性的...

    计算机网络实验报告

    本实验报告涵盖了几个关键的网络概念和技术,包括常用网络命令的使用、以太网帧的封装以及交换机的工作原理。 首先,实验一关注的是常用网络命令的掌握。这些命令对于网络管理员来说是日常工作的基础工具,例如: 1...

    基于IPV4/IPV6的流媒体内容分发网络研究

    - 使用封装类实现网络通信模块的功能,包括`IPAddress`类处理套接字地址,异常处理类管理Socket异常,以及网络通信类提供TCP、多线程和多路复用等功能。 - 下载并集成IPv6支持补丁,主要包括`tpipv6.h`和`wspiapi....

    c#学习笔记.txt

    尽管可能将一个点表示为类,但结构在某些方案中更有效。在一些情况下,结构的成本较低。例如,如果声明一个含有 1000 个点对象的数组,则将为引用每个对象分配附加的内存。结构可以声明构造函数,但它们必须带参数。...

    绍兴文理学院通风系统设备供货项目.docx

    招标文件的获取时间为2007年10月23日至2007年11月9日,工作日在绍兴市招投标中心指定地点购买,每套招标文件售价100元,且不退。报名时需提供企业法人营业执照原件及复印件、报名表、报名人身份证原件及复印件,以及...

    C课程设计教职工信息管理系统源代码.pdf

    3. 组合类:`Time`类表示时间,包含年、月、日三个整型变量,是`Telem`类的一个组成部分,体现了类的组合特性。 4. 虚基类和派生类:`People`类作为虚基类,拥有`Teacher`和`worker`两个派生类,这是面向对象中的...

    《跟我学Java26日通》随堂笔记 java教学课件

    9. **反射机制**:Java反射机制允许程序在运行时动态地获取类的信息并调用其方法,是许多框架和工具(如Spring)的基础。 10. **Java虚拟机(JVM)**:了解JVM的工作原理,包括类加载、内存管理(堆、栈、方法区等...

    对日项目中经常使用到的单词

    在对日IT项目中,经常会遇到许多专业术语,这些词汇是进行有效沟通和技术实施的关键。以下是一些重要的技术概念和词汇的详细解释: 1. **オラクル(Oracle)**:Oracle是一家全球知名的数据库管理系统供应商,提供...

    ssd5 Exercise 1

    Date类是处理日期的常见数据结构,它可能包含构造函数、析构函数、比较操作符(如==、&lt;)、获取和设置日期组件(年、月、日)的方法等。测试代码会涵盖这些功能的不同组合,以确保日期操作的正确性。 3. **...

    C#使用日历表(源码)

    - 另外,还可以结合`DateTime`对象,通过比较和计算来实现特定日期的逻辑处理,如判断是否是工作日、节假日等。 4. **源码分析** - 压缩包中的“实例039 使用日历表”源码可能包含一个简单的C# Windows Forms应用...

    Date Util

    这些类提供了丰富的API,如获取年月日、时分秒、比较日期等。比如,`LocalDateTime.now()`可以获取当前日期时间,`LocalDateTime.parse("2022-03-15T10:30")`可以从字符串解析出日期时间。 在"Date Util"中,可能...

    最简单时间显示.rar

    例如,将时间显示的逻辑封装到单独的函数或类中,使用清晰的变量名,编写注释来解释代码的工作方式,这些都是提高代码质量的有效手段。 综上所述,"最简单时间显示"这个主题涵盖了许多编程和软件设计的基本概念,从...

    公历转农历的算法 公历转农历的算法

    该类接收一个`DateTime`类型的参数,并利用`ChineseLunisolarCalendar`类的实例`cc`来获取农历的年、月、日及是否为闰月的信息。 - `GetYear()`, `GetMonth()`, 和 `GetDayOfMonth()` 方法分别用于获取农历的年份、...

    java面试问题集锦(92个真题)-腾讯QQ

    - Class类:获取类的信息,如构造器、方法、字段等。 - 动态调用:使用Class对象创建对象,调用方法,设置和获取字段值。 9. **网络编程** - Socket编程:TCP和UDP通信的基本概念和实现。 - URL和URLConnection...

Global site tag (gtag.js) - Google Analytics