(更新时间)2021年5月19日 仓库温控系统(Winform) 05 获取类属性静态方法PropertyHelper

编程入门 行业动态 更新时间:2024-10-05 09:28:49

(<a href=https://www.elefans.com/category/jswz/34/1764326.html style=更新时间)2021年5月19日 仓库温控系统(Winform) 05 获取类属性静态方法PropertyHelper"/>

(更新时间)2021年5月19日 仓库温控系统(Winform) 05 获取类属性静态方法PropertyHelper

public class PropertyHelper
{/// <summary>/// 返回指定类型的指定列名的属性数组/// </summary>/// <typeparam name="T"></typeparam>/// <param name="cols"></param>/// <returns></returns>public static PropertyInfo[] GetTypeProperties<T>(string cols){Type type = typeof(T);//将列名字符串转换成List,转换成小写List<string> listCols = cols.GetStrList(',', true);//获取所有属性PropertyInfo[] properties = type.GetProperties();if (listCols != null && listCols.Count > 0){properties = properties.Where(p => listCols.Contains(p.GetColName().ToLower())).ToArray();}return properties;}
}

更多推荐

(更新时间)2021年5月19日 仓库温控系统(Winform) 05 获取类属性静态方法PropertyHelper

本文发布于:2024-02-14 16:03:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1764312.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:更新时间   静态   仓库   方法   系统

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!