要移除PropertyInfo中的属性,可以使用以下代码:

using System.Reflection;

// 获取类型的属性
PropertyInfo property = typeof(YourClass).GetProperty("PropertyName");

// 移除属性
PropertyInfo[] properties = typeof(YourClass).GetProperties()
    .Where(p => p != property)
    .ToArray();

这将从YourClass类型中获取所有的属性,并使用LINQ排除要移除的属性,然后将剩余的属性存储在properties数组中。

怎么移除PropertyInfo 这里面的属性

原文地址: http://www.cveoy.top/t/topic/ioWZ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录