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
- LZCodec.cs
- ArgumentException.cs
- OperationFormatter.cs
- DbConnectionPoolGroup.cs
- NotifyIcon.cs
- EncoderReplacementFallback.cs
- AsyncPostBackErrorEventArgs.cs
- TextServicesPropertyRanges.cs
- ArrayList.cs
- GPPOINT.cs
- QueryStringParameter.cs
- MsmqChannelListenerBase.cs
- WindowsTitleBar.cs
- Tool.cs
- IgnoreDataMemberAttribute.cs
- FontStyleConverter.cs
- controlskin.cs
- MenuScrollingVisibilityConverter.cs
- KeyFrames.cs
- CultureInfoConverter.cs
- ComplexPropertyEntry.cs
- TableItemProviderWrapper.cs
- RichTextBox.cs
- LambdaCompiler.Lambda.cs
- GridViewRowCollection.cs
- WebServiceClientProxyGenerator.cs
- WebControlParameterProxy.cs
- ToolboxItemAttribute.cs
- FloaterParagraph.cs
- CompoundFileStreamReference.cs
- IxmlLineInfo.cs
- DesignerCatalogPartChrome.cs
- HopperCache.cs
- CustomLineCap.cs
- _HTTPDateParse.cs
- AttributeCollection.cs
- CommandEventArgs.cs
- DataGridRelationshipRow.cs
- NameScope.cs
- ClientBuildManager.cs
- StringUtil.cs
- MeasureItemEvent.cs
- SingleAnimationUsingKeyFrames.cs
- RoleServiceManager.cs
- SqlMethodAttribute.cs
- SymmetricKeyWrap.cs
- WindowProviderWrapper.cs
- Bitmap.cs
- DispatchWrapper.cs
- InputProviderSite.cs
- TagNameToTypeMapper.cs
- XmlLanguageConverter.cs
- StyleModeStack.cs
- TrackingMemoryStreamFactory.cs
- AppModelKnownContentFactory.cs
- ConnectionPointCookie.cs
- EventSourceCreationData.cs
- FileDialogPermission.cs
- Italic.cs
- WebPartTransformerAttribute.cs
- EditorZoneBase.cs
- QualifierSet.cs
- SchemaImporter.cs
- IProducerConsumerCollection.cs
- coordinatorfactory.cs
- DayRenderEvent.cs
- UserControl.cs
- WebResponse.cs
- _AcceptOverlappedAsyncResult.cs
- RemotingConfigParser.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- TrackingRecordPreFilter.cs
- QueryCacheKey.cs
- DbResourceAllocator.cs
- InvalidFilterCriteriaException.cs
- SslStreamSecurityUpgradeProvider.cs
- CodeAccessPermission.cs
- SerializationStore.cs
- DocumentPageHost.cs
- TdsParserStateObject.cs
- ListBoxItem.cs
- PageCatalogPart.cs
- WpfKnownMemberInvoker.cs
- PropertyEntry.cs
- ArgumentOutOfRangeException.cs
- QueryableDataSourceView.cs
- FtpWebResponse.cs
- EntityCommandExecutionException.cs
- ListenerConnectionDemuxer.cs
- WindowsGrip.cs
- Item.cs
- CodeIdentifiers.cs
- SubMenuStyleCollection.cs
- DataGridItemEventArgs.cs
- XmlSignificantWhitespace.cs
- SqlConnectionStringBuilder.cs
- NetworkAddressChange.cs
- TaiwanLunisolarCalendar.cs
- CorrelationToken.cs
- PermissionToken.cs