现在的位置: 首页 > 综合 > 正文

实体类转Hashtable

2013年08月30日 ⁄ 综合 ⁄ 共 266字 ⁄ 字号 评论关闭

private Hashtable ConvertDto2Ht()
        {
            Hashtable _ht = new Hashtable();
            PropertyInfo[] propertyInfos = dto.GetType().GetProperties();
            foreach (PropertyInfo item in propertyInfos)
            {
                _ht.Add(item.Name, item.GetValue(dto, null));
            }
            return _ht;
        }

抱歉!评论已关闭.