Files
2026-02-21 16:45:37 +08:00

24 lines
511 B
C#

using System;
using System.Reflection;
namespace SRF.Helpers
{
public static class SRReflection
{
public static void SetPropertyValue(object obj, PropertyInfo p, object value)
{
p.GetSetMethod().Invoke(obj, new object[1] { value });
}
public static object GetPropertyValue(object obj, PropertyInfo p)
{
return p.GetGetMethod().Invoke(obj, null);
}
public static T GetAttribute<T>(MemberInfo t) where T : Attribute
{
return Attribute.GetCustomAttribute(t, typeof(T)) as T;
}
}
}