Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Xml / System / Xml / XPath / Internal / XPathArrayIterator.cs / 5 / XPathArrayIterator.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace MS.Internal.Xml.XPath {
using System;
using System.Xml;
using System.Xml.XPath;
using System.Diagnostics;
using System.Globalization;
using System.Collections;
[DebuggerDisplay("Position={CurrentPosition}, Current={debuggerDisplayProxy, nq}")]
internal class XPathArrayIterator : ResetableIterator {
protected IList list;
protected int index;
public XPathArrayIterator(IList list) {
this.list = list;
}
public XPathArrayIterator(XPathArrayIterator it) {
this.list = it.list;
this.index = it.index;
}
public XPathArrayIterator(XPathNodeIterator nodeIterator) {
this.list = new ArrayList();
while (nodeIterator.MoveNext()) {
this.list.Add(nodeIterator.Current.Clone());
}
}
public IList AsList {
get { return this.list; }
}
public override XPathNodeIterator Clone() {
return new XPathArrayIterator(this);
}
public override XPathNavigator Current {
get {
Debug.Assert(index <= list.Count);
if (index < 1)
throw new InvalidOperationException(Res.GetString(Res.Sch_EnumNotStarted, string.Empty));
return (XPathNavigator) list[index - 1];
}
}
public override int CurrentPosition { get { return index; } }
public override int Count { get { return list.Count; } }
public override bool MoveNext() {
Debug.Assert(index <= list.Count);
if (index == list.Count) {
return false;
}
index++;
return true;
}
public override void Reset() {
index = 0;
}
public override IEnumerator GetEnumerator() {
return list.GetEnumerator();
}
private object debuggerDisplayProxy { get { return index < 1 ? null : (object)new XPathNavigator.DebuggerDisplayProxy(Current); } }
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace MS.Internal.Xml.XPath {
using System;
using System.Xml;
using System.Xml.XPath;
using System.Diagnostics;
using System.Globalization;
using System.Collections;
[DebuggerDisplay("Position={CurrentPosition}, Current={debuggerDisplayProxy, nq}")]
internal class XPathArrayIterator : ResetableIterator {
protected IList list;
protected int index;
public XPathArrayIterator(IList list) {
this.list = list;
}
public XPathArrayIterator(XPathArrayIterator it) {
this.list = it.list;
this.index = it.index;
}
public XPathArrayIterator(XPathNodeIterator nodeIterator) {
this.list = new ArrayList();
while (nodeIterator.MoveNext()) {
this.list.Add(nodeIterator.Current.Clone());
}
}
public IList AsList {
get { return this.list; }
}
public override XPathNodeIterator Clone() {
return new XPathArrayIterator(this);
}
public override XPathNavigator Current {
get {
Debug.Assert(index <= list.Count);
if (index < 1)
throw new InvalidOperationException(Res.GetString(Res.Sch_EnumNotStarted, string.Empty));
return (XPathNavigator) list[index - 1];
}
}
public override int CurrentPosition { get { return index; } }
public override int Count { get { return list.Count; } }
public override bool MoveNext() {
Debug.Assert(index <= list.Count);
if (index == list.Count) {
return false;
}
index++;
return true;
}
public override void Reset() {
index = 0;
}
public override IEnumerator GetEnumerator() {
return list.GetEnumerator();
}
private object debuggerDisplayProxy { get { return index < 1 ? null : (object)new XPathNavigator.DebuggerDisplayProxy(Current); } }
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProfileModule.cs
- ConfigurationPropertyAttribute.cs
- XmlExpressionDumper.cs
- SQLInt64Storage.cs
- PassportAuthenticationModule.cs
- CachingParameterInspector.cs
- ProxyWebPartConnectionCollection.cs
- HeaderFilter.cs
- DataGridViewComboBoxCell.cs
- Configuration.cs
- RouteParser.cs
- HitTestWithGeometryDrawingContextWalker.cs
- XmlSequenceWriter.cs
- Rotation3D.cs
- GridViewPageEventArgs.cs
- XmlAttribute.cs
- HttpHostedTransportConfiguration.cs
- TimeoutValidationAttribute.cs
- TextTreePropertyUndoUnit.cs
- ContextMenu.cs
- SpellerStatusTable.cs
- TextServicesCompartmentEventSink.cs
- CompoundFileStorageReference.cs
- ClassData.cs
- SessionState.cs
- XmlArrayItemAttribute.cs
- CommonProperties.cs
- TypeDependencyAttribute.cs
- NavigationWindowAutomationPeer.cs
- DataSourceControlBuilder.cs
- ContentDesigner.cs
- OleDbStruct.cs
- ConnectionManager.cs
- AssertFilter.cs
- unsafeIndexingFilterStream.cs
- SafeNativeMethods.cs
- ProcessMessagesAsyncResult.cs
- TypeReference.cs
- DataControlLinkButton.cs
- OledbConnectionStringbuilder.cs
- ToolStripItemTextRenderEventArgs.cs
- IPAddressCollection.cs
- GacUtil.cs
- WebPartTransformerCollection.cs
- ScriptMethodAttribute.cs
- ContentFileHelper.cs
- EncoderExceptionFallback.cs
- SmtpClient.cs
- EditorPartCollection.cs
- Speller.cs
- StructuralObject.cs
- SafeThreadHandle.cs
- XmlSchemaDatatype.cs
- XmlSchemaDatatype.cs
- RoleGroupCollection.cs
- XmlLangPropertyAttribute.cs
- CharUnicodeInfo.cs
- SqlRowUpdatingEvent.cs
- NavigateEvent.cs
- OleDbPropertySetGuid.cs
- SoapSchemaImporter.cs
- ActivityMarkupSerializer.cs
- PenThread.cs
- ByteRangeDownloader.cs
- RequestCachingSection.cs
- GenericIdentity.cs
- TableColumn.cs
- SequentialUshortCollection.cs
- httpstaticobjectscollection.cs
- RSAPKCS1KeyExchangeFormatter.cs
- Resources.Designer.cs
- NTAccount.cs
- ObjectResult.cs
- InplaceBitmapMetadataWriter.cs
- FastEncoderWindow.cs
- AddInAdapter.cs
- DuplexClientBase.cs
- SemanticValue.cs
- ExpandoObject.cs
- SpecularMaterial.cs
- PageStatePersister.cs
- SafeArchiveContext.cs
- TrackingParameters.cs
- HtmlHead.cs
- Token.cs
- SecurityUtils.cs
- CharacterHit.cs
- TextWriterEngine.cs
- RuntimeResourceSet.cs
- MouseDevice.cs
- ProfileManager.cs
- UserControl.cs
- ScopelessEnumAttribute.cs
- MultipartContentParser.cs
- XmlSchemaType.cs
- DebugInfoExpression.cs
- CodeMethodReturnStatement.cs
- HttpCapabilitiesEvaluator.cs
- NamedElement.cs
- UnaryOperationBinder.cs