예제 #1
0
        public object GetValueFast(BagNode propBagNode, PropIdType propId, PropItemSetKeyType propItemSetKey)
        {
            if (propItemSetKey != propBagNode.PropItemSetKey)
            {
                throw new InvalidOperationException("Bad PropModel.");
            }

            if (!propBagNode.TryGetChild(propId, out PropNode child))
            {
                throw new InvalidOperationException("Could not retrieve PropNode for that compKey.");
            }

            object result = child.PropData_Internal.TypedProp.TypedValueAsObject;

            return(result);
        }
예제 #2
0
        public bool SetValueFast(BagNode propBagNode, PropIdType propId, PropItemSetKeyType propItemSetKey, object value)
        {
            if (propItemSetKey != propBagNode.PropItemSetKey)
            {
                throw new InvalidOperationException("Bad PropModel.");
            }

            if (!propBagNode.TryGetPropBag(out IPropBag component))
            {
                throw new InvalidOperationException("IPropBag target has been Garbage Collected.");
            }

            if (!propBagNode.TryGetChild(propId, out PropNode child))
            {
                throw new InvalidOperationException("Could not retrieve PropNode for that compKey.");
            }

            bool result = SetPropValue(component, child, propId, value);

            return(result);
        }