internal void Replaced(PropertyBehavior <TComponent> old, PropertyBehavior <TComponent> newer) { old.SetParent(null); newer.SetParent(this); bool removed = _properties.Remove(old); _properties.Add(newer); }
internal PropertyBehavior <TComponent> Property(bool canGet, bool canAdd, string name, Access access) { PropertyBehavior <TComponent> found = _properties.FirstOrDefault(p => p.Name == name); if (found == null) { if (canAdd) { found = new PropertyBehavior <TComponent>(name, access); found.SetParent(this); _properties.Add(found); } } else if (!canGet) { found = null; } else { found.Decoration.AccessModifier = access; } return(found); }
/// <summary> /// Declares a property setter for a parameter /// </summary> /// <typeparam name="T">Type of property</typeparam> /// <param name="property">Property to set</param> /// <returns>Parameter</returns> public static Param <Action <T> > Setter <TComponent, T>(PropertyBehavior <TComponent, T> property) where TComponent : class => new ParamDecorator <Action <T> >(new PropertySetterParam <TComponent>(property, typeof(T)));