通过父类创建子类

通过父类创建子类
 
复制代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZZX.Model.ViewModel
{
    /// <summary>
    /// 用户所申请的工作
    /// </summary>
    public class UserJob:Job
    {
        /// <summary>
        /// 子类构造函数
        /// </summary>
        /// <param name="parent">父类对象</param>
        public UserJob(Job parent)
        {
            var parentProperties = parent.GetType().GetProperties();
            foreach (var parentProperty in parentProperties)
            {
                var thisProperty = this.GetType().GetProperty(parentProperty.Name, parentProperty.PropertyType);
                var value = parentProperty.GetValue(parent);
                if (thisProperty != null && value != null && thisProperty.CanWrite)
                {
                    thisProperty.SetValue(this, value);
                }
            }
        }


        /// <summary>
        /// 申请状态
        /// </summary>
        public int ApplyStatus { set; get; }
        /// <summary>
        /// 申请状态描述
        /// </summary>
        public string ApplyStatusText { set; get; }
        /// <summary>
        /// 申请领薪资的方式
        /// </summary>
       public int ApplySalaryWay { set; get; }
        /// <summary>
        /// 申请领薪资的方式描述
        /// </summary>
        public string ApplySalaryWayText { set; get; }
    }
}
复制代码

 

posted @   牛腩  阅读(66)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2009-08-28 两个整形变量,不用中间变量进行替换!
点击右上角即可分享
微信分享提示