Open.Core.ModelBase.GetPropertyRef C# (CSharp) Method

GetPropertyRef() public method

Retrieves a singleton instance to the handle to the named property.
public GetPropertyRef ( string propertyName ) : PropertyRef
propertyName string The name of the property to retrieve.
return PropertyRef
        public PropertyRef GetPropertyRef(string propertyName)
        {
            // Return the the property-ref if an instance already exists.
            PropertyRef propertyRef = GetPropertyRefFromList(propertyName);
            if (propertyRef != null) return propertyRef;

            // Don't continue if the property does not exist.
            if (!Helper.Reflection.HasProperty(this, propertyName)) return null;

            // Create a new property-ref.
            propertyRef = new PropertyRef(this, propertyName);
            PropertyRefs.Add(propertyRef);

            // Finish up.
            return propertyRef;
        }
        #endregion