static bool Unset(ref NPropertyBag head, NProperty key) { var e = head.GetEntry(key); if (e == null) { return(false); // value not changed -> do nothing } head = head.Clone(); head.Remove(key); return(true); }
static bool Set(ref NPropertyBag head, NProperty key, object value) { var e = head.GetEntry(key); if (e != null && Equals(e._value, value)) { return(false); // value not changed -> do nothing } head = head.Clone(); head.Set(key, value); return(true); }
/// <summary> /// Defines custom logic to update component in case of property or state changes /// </summary> /// <returns>Returns true if properties or state is changed</returns> protected virtual bool ShouldComponentUpdate(NPropertyBag props, NPropertyBag state, NPropertyBag oldProps, NPropertyBag oldState) { return(props.Head != oldProps.Head || state.Head != oldState.Head); }