System.Xml.XmlNodeReaderNavigator.GetAttribute C# (CSharp) Method

GetAttribute() public method

public GetAttribute ( int attributeIndex ) : String
attributeIndex int
return String
            public String GetAttribute( int attributeIndex ) {
                if( this.bCreatedOnAttribute )
                    return null;
                switch ( curNode.NodeType ) {
                    case XmlNodeType.Element:
                        CheckIndexCondition( attributeIndex );
                        return ((XmlElement)curNode).Attributes[attributeIndex].Value;
                    case XmlNodeType.Attribute :
                        CheckIndexCondition( attributeIndex );
                        return ((XmlElement)elemNode).Attributes[attributeIndex].Value;
                    case XmlNodeType.XmlDeclaration: {
                        CheckIndexCondition( attributeIndex );
                        return GetDeclarationAttr( attributeIndex );
                    }
                    case XmlNodeType.DocumentType: {
                        CheckIndexCondition( attributeIndex );
                        return GetDocumentTypeAttr( attributeIndex );
                    }
                }
                throw new ArgumentOutOfRangeException( "attributeIndex" ); //for other senario, AttributeCount is 0, i has to be out of range
            }

Same methods

XmlNodeReaderNavigator::GetAttribute ( String name ) : String
XmlNodeReaderNavigator::GetAttribute ( String name, String ns ) : String