/// <summary> /// Clones the given <see cref="IProjection{TSource, TResult}"/> /// if the projection is sensitive to the viewport; otherwise, the /// projection itself is returned unmodified. /// </summary> /// <typeparam name="TSource"> /// The <see cref="System.Type"/> of argument to the projection. /// </typeparam> /// <typeparam name="TResult"> /// The <see cref="System.Type"/> of the result of the projection. /// </typeparam> /// <param name="self"> /// The projection being cloned. /// </param> /// <returns> /// A clone of the specified projection, if possible; /// <paramref name="self"/> otherwise. /// </returns> public static IProjection <TSource, TResult> CloneIfViewportSensitive <TSource, TResult>( this IProjection <TSource, TResult> self) { if (self.DependsOnViewport()) { return((IProjection <TSource, TResult>)((IViewportSensitiveProjection)self).Clone()); } return(self); }