public bool RegisterDynamicProperty(IDynamicProperty prop) { lock (this) { if (FindProperty(prop.Name) != -1) { throw new InvalidOperationException("Another property by this name already exists"); } // Make a copy, do not interfere with threads running dynamic sinks ArrayList newProps = new ArrayList(_properties); DynamicPropertyReg reg = new DynamicPropertyReg(); reg.Property = prop; IContributeDynamicSink contributor = prop as IContributeDynamicSink; if (contributor != null) { reg.Sink = contributor.GetDynamicSink(); } newProps.Add(reg); _properties = newProps; return(true); // When should be false? } }
public bool RegisterDynamicProperty(IDynamicProperty prop) { lock (this) { if (FindProperty (prop.Name) != -1) throw new InvalidOperationException ("Another property by this name already exists"); // Make a copy, do not interfere with threads running dynamic sinks ArrayList newProps = new ArrayList (_properties); DynamicPropertyReg reg = new DynamicPropertyReg(); reg.Property = prop; IContributeDynamicSink contributor = prop as IContributeDynamicSink; if (contributor != null) reg.Sink = contributor.GetDynamicSink (); newProps.Add (reg); _properties = newProps; return true; // When should be false? } }