public static BaseNetProp GetNetProp(IHasNetProps instance, NetPropertyAttributeData propAttr) { if (propAttr.PropertyType.IsUnmanaged()) { var genericType = typeof(UnmanagedNetProp <>).MakeGenericType(propAttr.PropertyType); return(Activator.CreateInstance(genericType, instance, propAttr) as BaseNetProp); } return(null); }
public static List <NetPropertyAttributeData> GetAttributeData(Type t) { if (!_attributeCache.ContainsKey(t)) { _attributeCache[t] = new List <NetPropertyAttributeData>(); foreach (PropertyInfo p in t.GetProperties()) { foreach (Attribute a in p.GetCustomAttributes(true)) { if (a is NetPropertyAttribute np) { var attrData = new NetPropertyAttributeData(p, np); _attributeCache[t].Add(attrData); } } } } return(_attributeCache[t]); }
public UnmanagedNetProp(IHasNetProps instance, NetPropertyAttributeData data) : base(instance, data) { _get = data.Getter.CreateDelegate(typeof(Func <T>), instance) as Func <T>; _set = data.Setter.CreateDelegate(typeof(Action <T>), instance) as Action <T>; }
public BaseNetProp(IHasNetProps instance, NetPropertyAttributeData propAttr) { Entity = instance; PropAttr = propAttr; }