System.Xml.XmlReader.MoveToElement C# (CSharp) Method

MoveToElement() public abstract method

public abstract MoveToElement ( ) : bool
return bool
        public abstract bool MoveToElement();

Usage Example

        public static ColorEx ParseColorAttributes(XmlReader r)
        {
            float R = 0;
            float G = 0;
            float B = 0;

            for (int i = 0; i < r.AttributeCount; i++)
            {
                r.MoveToAttribute(i);

                // set the field in this object based on the element we just read
                switch (r.Name)
                {
                    case "R":
                        R = float.Parse(r.Value);
                        break;
                    case "G":
                        G = float.Parse(r.Value);
                        break;
                    case "B":
                        B = float.Parse(r.Value);
                        break;
                }
            }
            r.MoveToElement(); //Moves the reader back to the element node.

            r.MoveToElement(); //Moves the reader back to the element node.
            if (R > 1 || G > 1 || B > 1)
            {
                R = R / 255;
                G = G / 255;
                B = B / 255;
            }
            return new ColorEx(R, G, B);
        }
All Usage Examples Of System.Xml.XmlReader::MoveToElement