System.Xml.XmlNodeReader.MoveToFirstAttribute C# (CSharp) Méthode

MoveToFirstAttribute() public méthode

public MoveToFirstAttribute ( ) : bool
Résultat bool
        public override bool MoveToFirstAttribute() {
            if ( !IsInReadingStates() )
                return false;
            readerNav.ResetMove( ref curDepth, ref nodeType );
            if (AttributeCount > 0) {
                readerNav.MoveToAttribute( 0 );
                curDepth++;
                nodeType = readerNav.NodeType;
                if ( bInReadBinary ) {
                    FinishReadBinary();
                }
                return true;
            }
            readerNav.RollBackMove( ref curDepth );
            return false;
        }

Usage Example

		[Test] // bug #550379
		public void MoveToNextAttributeFromValue ()
		{
			document.LoadXml ("<ul test='xxx'></ul>");
			XmlNodeReader nr = new XmlNodeReader (document);
			nr.Read ();
			//nr.Read (); // why twice?
			Assert.IsTrue (nr.MoveToFirstAttribute (), "#1");
			Assert.IsTrue (nr.ReadAttributeValue (), "#2");
			Assert.IsFalse (nr.MoveToNextAttribute (), "#3");
		}
All Usage Examples Of System.Xml.XmlNodeReader::MoveToFirstAttribute