コード例 #1
0
ファイル: ScopeLink.cs プロジェクト: HatTrickLabs/txt
        public object Peek(int back)
        {
            if (back < 0)
            {
                throw new ArgumentException("value cannot be a negative number", nameof(back));
            }

            if (back == 0)
            {
                return(_item);
            }

            return(_children.Peek(--back));
        }
コード例 #2
0
        public object Peek(int back)
        {
            if (back >= _depth)
            {
                throw new ArgumentException("value must be < ScopeChain.Depth", nameof(back));
            }

            if (back < 0)
            {
                throw new ArgumentException("value cannot be a negative number", nameof(back));
            }

            if (_links == null)
            {
                throw new MergeException("cannot 'Peek' scope link, the chain is empty");
            }

            return(_links.Peek(back));
        }