IxmlLineInfo.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / IxmlLineInfo.cs / 1305376 / IxmlLineInfo.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
//-----------------------------------------------------------------------------
 
namespace System.Xml { 
    /// 
    public interface IXmlLineInfo { 
        /// 
        bool HasLineInfo();
        /// 
        int LineNumber { get; } 
        /// 
        int LinePosition { get; } 
    } 

#if !SILVERLIGHT 
    internal class PositionInfo : IXmlLineInfo {
        public virtual bool HasLineInfo() { return false; }
        public virtual int LineNumber { get { return 0;} }
        public virtual int LinePosition { get { return 0;} } 

        public static PositionInfo GetPositionInfo(Object o) { 
            IXmlLineInfo li = o as IXmlLineInfo; 
            if (li != null) {
                return new ReaderPositionInfo(li); 
            }
            else {
                return new PositionInfo();
            } 
        }
    } 
 
    internal class ReaderPositionInfo: PositionInfo {
        private IXmlLineInfo lineInfo; 

        public ReaderPositionInfo(IXmlLineInfo lineInfo) {
            this.lineInfo = lineInfo;
        } 

        public override bool HasLineInfo() { 
            return lineInfo.HasLineInfo(); 
        }
 
        public override int LineNumber {
            get {
                return lineInfo.LineNumber;
            } 
        }
 
        public override int LinePosition { 
            get {
                return lineInfo.LinePosition; 
            }
        }
    }
#endif 
}// namespace

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK