using System.Linq.Expressions; namespace Tnb.EquipMgr.Utils { //public class PropertySet //{ // public static Dictionary> ValueFactories = new Dictionary>(StringComparer.OrdinalIgnoreCase); // public static Action CreateSetPropertyValueAction(string propertyName) // { // var property = typeof(T).GetProperty(propertyName); // var target = Expression.Parameter(typeof(object)); // var propertyValue = Expression.Parameter(typeof(object)); // var castTarget = Expression.Convert(target, typeof(T)); // var castPropertyValue = Expression.Convert(propertyValue, property!.PropertyType); // var setPropertyValue = Expression.Call(castTarget, property.GetSetMethod()!, castPropertyValue); // return Expression.Lambda>(setPropertyValue, target, propertyValue).Compile(); // } //} }