Microsoft.CodeAnalysis.SyntaxNodeOrTokenList.this C# (CSharp) Method

this() public method

Gets the SyntaxNodeOrToken at the specified index.
is out of range.
public this ( int index ) : Microsoft.CodeAnalysis.SyntaxNodeOrToken
index int
return Microsoft.CodeAnalysis.SyntaxNodeOrToken
        public SyntaxNodeOrToken this[int index]
        {
            get
            {
                if (_node != null)
                {
                    if (!_node.IsList)
                    {
                        if (index == 0)
                        {
                            return _node;
                        }
                    }
                    else
                    {
                        if (unchecked((uint)index < (uint)_node.SlotCount))
                        {
                            var green = _node.Green.GetSlot(index);
                            if (green.IsToken)
                            {
                                return new SyntaxToken(this.Parent, green, _node.GetChildPosition(index), this.index + index);
                            }

                            return _node.GetNodeSlot(index);
                        }
                    }
                }

                throw new ArgumentOutOfRangeException(nameof(index));
            }
        }