/// <summary> /// Initializes a new instance of the <see cref="CSF.Zpt.ExpressionEvaluators.PathExpressions.PathComponent"/> class. /// </summary> /// <param name="parts">Parts.</param> internal PathComponent(PathPart[] parts) { if(parts == null) { throw new ArgumentNullException(nameof(parts)); } _parts = new ReadOnlyCollection<PathPart>(parts); }
/// <summary> /// Attempts to get a part-name for traversal, expanding interpolated part-names if appropriate. /// </summary> /// <returns><c>true</c>, if a part name was resolved, <c>false</c> otherwise.</returns> /// <param name="part">A TALES path part.</param> /// <param name="context">The rendering context.</param> /// <param name="model">The TALES model.</param> /// <param name="result">Exposes the result of this operation.</param> private bool TryGetPartName(PathPart part, IRenderingContext context, ITalesModel model, out string result) { result = part.Value; bool output = true; if(part.IsInterpolated) { object interpolatedValue; if(model.TryGetRootObject(result, context, out interpolatedValue) && interpolatedValue != null) { output = true; result = interpolatedValue.ToString(); } else { output = false; result = null; } } return output; }