Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / Runtime / XmlNavigatorStack.cs / 1305376 / XmlNavigatorStack.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
using System;
using System.Xml;
using System.Xml.XPath;
using System.Diagnostics;
namespace System.Xml.Xsl.Runtime {
///
/// A dynamic stack of IXmlNavigators.
///
internal struct XmlNavigatorStack {
private XPathNavigator[] stkNav; // Stack of XPathNavigators
private int sp; // Stack pointer (size of stack)
#if DEBUG
private const int InitialStackSize = 2;
#else
private const int InitialStackSize = 8;
#endif
///
/// Push a navigator onto the stack
///
public void Push(XPathNavigator nav) {
if (this.stkNav == null)
{
this.stkNav = new XPathNavigator[InitialStackSize];
}
else
{
if (this.sp >= this.stkNav.Length)
{
// Resize the stack
XPathNavigator[] stkOld = this.stkNav;
this.stkNav = new XPathNavigator[2 * this.sp];
Array.Copy(stkOld, this.stkNav, this.sp);
}
}
this.stkNav[this.sp++] = nav;
}
///
/// Pop the topmost navigator and return it
///
public XPathNavigator Pop() {
Debug.Assert(!IsEmpty);
return this.stkNav[--this.sp];
}
///
/// Returns the navigator at the top of the stack without adjusting the stack pointer
///
public XPathNavigator Peek() {
Debug.Assert(!IsEmpty);
return this.stkNav[this.sp - 1];
}
///
/// Remove all navigators from the stack
///
public void Reset() {
this.sp = 0;
}
///
/// Returns true if there are no navigators in the stack
///
public bool IsEmpty {
get { return this.sp == 0; }
}
}
}
// 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
- DockingAttribute.cs
- GZipStream.cs
- TypedRowGenerator.cs
- NullableBoolConverter.cs
- XPathNodeHelper.cs
- DesignerPerfEventProvider.cs
- ParentQuery.cs
- DataGridColumnCollectionEditor.cs
- FormatConvertedBitmap.cs
- TextParagraphProperties.cs
- SerializationInfoEnumerator.cs
- XmlSchemaParticle.cs
- DataColumn.cs
- HandleDictionary.cs
- Image.cs
- httpapplicationstate.cs
- UIAgentAsyncParams.cs
- InkCanvasFeedbackAdorner.cs
- JavaScriptString.cs
- SystemResourceHost.cs
- MailBnfHelper.cs
- MetadataItem_Static.cs
- StringUtil.cs
- IntegerFacetDescriptionElement.cs
- SqlProviderManifest.cs
- TouchDevice.cs
- RouteTable.cs
- ArgumentOutOfRangeException.cs
- EventLogPermissionEntry.cs
- CacheMemory.cs
- InstanceKeyView.cs
- StylusPointPropertyUnit.cs
- ApplicationServicesHostFactory.cs
- AnimationClockResource.cs
- HGlobalSafeHandle.cs
- RoleManagerEventArgs.cs
- RelativeSource.cs
- RtfControls.cs
- GeneratedView.cs
- StyleCollection.cs
- AutomationPropertyChangedEventArgs.cs
- EdmToObjectNamespaceMap.cs
- StateMachineSubscriptionManager.cs
- ColumnBinding.cs
- HScrollProperties.cs
- FixedSOMImage.cs
- PanelStyle.cs
- X509Certificate.cs
- DbParameterCollectionHelper.cs
- StructuralType.cs
- HtmlCalendarAdapter.cs
- InkCanvasFeedbackAdorner.cs
- XamlReader.cs
- SectionInput.cs
- KnownBoxes.cs
- _SslSessionsCache.cs
- SelectManyQueryOperator.cs
- CssStyleCollection.cs
- UniqueIdentifierService.cs
- OracleConnection.cs
- SeverityFilter.cs
- CalendarTable.cs
- ChildDocumentBlock.cs
- DesignerHelpers.cs
- WebPartZoneBase.cs
- LogExtent.cs
- SystemGatewayIPAddressInformation.cs
- StringOutput.cs
- ReadOnlyObservableCollection.cs
- MruCache.cs
- ComponentResourceKeyConverter.cs
- DataColumnCollection.cs
- OdbcFactory.cs
- ErrorTableItemStyle.cs
- EditorPart.cs
- SecurityDescriptor.cs
- PhysicalFontFamily.cs
- Registry.cs
- PixelShader.cs
- SchemaNames.cs
- NavigationHelper.cs
- FixUpCollection.cs
- WmlFormAdapter.cs
- TextSimpleMarkerProperties.cs
- SapiInterop.cs
- KnownIds.cs
- DataSourceControl.cs
- HScrollBar.cs
- CalendarDayButton.cs
- ConfigUtil.cs
- TextureBrush.cs
- RsaKeyIdentifierClause.cs
- WebPartCatalogAddVerb.cs
- XmlSchemaElement.cs
- SoapServerProtocol.cs
- DrawingImage.cs
- XslAstAnalyzer.cs
- Transform3DCollection.cs
- StateWorkerRequest.cs
- Panel.cs