/// <summary>
        /// 获取属性值
        /// </summary>
        /// <param name="name"></param>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static object GetValue(this Attendee entity, string name)
        {
            try
            {
                PropertyInfo p = _type.GetProperty(name);
                if (p != null)
                {
                    return p.GetValue(entity);
                }
                return null;
            }
            catch 
            {
                return null;
            }
            
        }

调用:

var attendee = new Attendee(attendeeId, request.BventId, "", attendeeRole: (int)AttendeeRoleEnum.EssayExpert, AttendeeStatus.Unregistered, checkinCode);
var value = attendee.GetValue(fieldName);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-08-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2021-06-03
相关资源
相似解决方案