Пример #1
0
        public static IType DeepGetPassthroughObject(this IPassthrough passthrough)
        {
            IType result = passthrough.PassthroughExpression;

            while (result is IPassthrough pt)
            {
                result = pt.PassthroughExpression;
            }
            return(result);
        }
Пример #2
0
        public static IType DeepReplacePassthroughObject(this IPassthrough passthrough, IType replacement)
        {
            Stack <IPassthrough> passthroughStack = new Stack <IPassthrough>();

            passthroughStack.Push(passthrough);
            IType current = passthrough.PassthroughExpression;

            while (current is IPassthrough pt)
            {
                passthroughStack.Push(pt);
                current = pt.PassthroughExpression;
            }
            current = passthroughStack.Pop().ReplacePassthroughExpression(replacement);
            while (passthroughStack.Count > 0)
            {
                current = passthroughStack.Pop().ReplacePassthroughExpression(current);
            }
            return(current);
        }