src/Library/NetPro.Utility/Extenisons/Extensions.Reflection.cs
(完整代码) 775Busing System.Reflection;
namespace System.NetPro
{
/// <summary>
/// 系统扩展 - 反射
/// </summary>
public static partial class Extensions
{
/// <summary>
/// 获取实例上的属性值
/// </summary>
/// <param name="member">成员信息</param>
/// <param name="instance">成员所在的类实例</param>
public static object GetPropertyValue(this MemberInfo member, object instance)
{
if (member == null)
throw new ArgumentNullException(nameof(member));
if (instance == null)
throw new ArgumentNullException(nameof(instance));
return instance.GetType().GetProperty(member.Name)?.GetValue(instance);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。