ylbtech-Code-Function:根据属性返回实体的属性值 |
1.返回顶部 |
1、
using System; using System.Reflection; namespace Sp.Common { public class FunctionHelper { /// <summary> /// 根据属性返回实体的属性值 /// </summary> /// <param name="model">实体</param> /// <param name="key">属性</param> /// <returns></returns> public static string GetValueByKey(object model, string key) { Type type = model.GetType(); PropertyInfo info = type.GetProperty(key); return info.GetValue(model).ToString(); } } }
2、
2.返回顶部 |
3.返回顶部 |
4.返回顶部 |
5.返回顶部 |
6.返回顶部 |
![]() |
作者:ylbtech 出处:http://ylbtech.cnblogs.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |