Class XmlDataReader
Provides a way of reading a forward-only stream of rows from an XML based data source. This class cannot be inherited.
public sealed class XmlDataReader : DataReader<bool>, IDataReader, IDataRecord, IDisposable
- Inheritance
-
XmlDataReader
- Implements
- Inherited Members
Constructors
XmlDataReader(XmlReader, Func<string, object>, Action<FormattingOptions>)
Initializes a new instance of the XmlDataReader class.
public XmlDataReader(XmlReader reader, Func<string, object> parser = null, Action<FormattingOptions> setup = null)
Parameters
readerXmlReaderThe XmlReader object that contains the XML data.
parserFunc<string, object>The function delegate that returns a primitive object whose value is equivalent to the provided string value. Default is FromValueType().
setupAction<FormattingOptions>The FormattingOptions which may be configured.
Exceptions
- ArgumentNullException
readeris null.
Properties
Depth
Gets a value indicating the depth of nesting for the current element.
public override int Depth { get; }
Property Value
- int
The level of nesting.
NullRead
Gets the value that indicates that no more rows exists.
protected override bool NullRead { get; }
Property Value
- bool
The value that indicates that no more rows exists.
RowCount
Gets the currently processed row count of this instance.
public override int RowCount { get; protected set; }
Property Value
- int
The currently processed row count of this instance.
Remarks
This property is incremented when the invoked Read() method returns true.
Methods
OnDisposeManagedResources()
Called when this object is being disposed by either Dispose() or Dispose(bool) having disposing set to true and Disposed is false.
protected override void OnDisposeManagedResources()
Read()
Advances this instance to the next element of the XML data source.
public override bool Read()
Returns
- bool
trueif there are more elements; otherwise,false.
Exceptions
- ObjectDisposedException
This instance has been disposed.
ReadNext(bool)
Advances this instance to the next element of the XML data source.
protected override bool ReadNext(bool columns)
Parameters
columnsbool
Returns
- bool
trueif there are more elements; otherwise,false.
Exceptions
- ObjectDisposedException
This instance has been disposed.