/// <summary> /// Checks if the current chain is the child of another chain. /// For example, if chain1 were for "Parent.Child" and chain2 were for "Parent.Child.GrandChild" then /// chain2.IsChildChainOf(chain1) would be true. /// </summary> /// <param name="parentChain">The parent chain to compare</param> /// <returns>True if the current chain is the child of the other chain, otherwise false</returns> public bool IsChildChainOf(PropertyChain parentChain) { return(ToString().StartsWith(parentChain.ToString())); }
/// <summary> /// Builds a property path. /// </summary> public string BuildPropertyName(string propertyName) { var chain = new PropertyChain(this); chain.Add(propertyName); return chain.ToString(); }
/// <summary> /// Creates a new PropertyChain based on another. /// </summary> public PropertyChain(PropertyChain parent) { if(parent != null) { memberNames.AddRange(parent.memberNames); } }
/// <summary> /// Checks if the current chain is the child of another chain. /// For example, if chain1 were for "Parent.Child" and chain2 were for "Parent.Child.GrandChild" then /// chain2.IsChildChainOf(chain1) would be true. /// </summary> /// <param name="parentChain">The parent chain to compare</param> /// <returns>True if the current chain is the child of the other chain, otherwise false</returns> public bool IsChildChainOf(PropertyChain parentChain) { return ToString().StartsWith(parentChain.ToString()); }