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
- CustomErrorCollection.cs
- AppDomainAttributes.cs
- InkSerializer.cs
- ObjectItemConventionAssemblyLoader.cs
- DataSourceIDConverter.cs
- JpegBitmapEncoder.cs
- SingleConverter.cs
- StyleReferenceConverter.cs
- BezierSegment.cs
- Binding.cs
- AttachedPropertiesService.cs
- odbcmetadatafactory.cs
- DesignerSerializationOptionsAttribute.cs
- ForeignKeyConstraint.cs
- WebControlsSection.cs
- SystemResourceKey.cs
- ImagingCache.cs
- PageSetupDialog.cs
- PolicyStatement.cs
- InlineCollection.cs
- MethodBody.cs
- EncodingNLS.cs
- TreeNode.cs
- CommandField.cs
- indexingfiltermarshaler.cs
- TextMarkerSource.cs
- DesignTimeVisibleAttribute.cs
- ASCIIEncoding.cs
- WebPartEditorOkVerb.cs
- LogFlushAsyncResult.cs
- DictionaryEntry.cs
- HMACSHA512.cs
- OrderedDictionary.cs
- EntityViewGenerationConstants.cs
- XhtmlBasicLinkAdapter.cs
- WebBrowserHelper.cs
- ChameleonKey.cs
- StringBlob.cs
- Int16.cs
- CodeFieldReferenceExpression.cs
- FormViewInsertEventArgs.cs
- Point3DConverter.cs
- SqlConnectionFactory.cs
- SqlTransaction.cs
- ReturnType.cs
- RowsCopiedEventArgs.cs
- httpapplicationstate.cs
- initElementDictionary.cs
- KeyValueSerializer.cs
- MenuItemCollectionEditor.cs
- XamlFigureLengthSerializer.cs
- DataGridViewRowPostPaintEventArgs.cs
- Native.cs
- CultureInfo.cs
- CursorConverter.cs
- ProviderCollection.cs
- SqlDataSource.cs
- XmlUrlResolver.cs
- Light.cs
- HostProtectionPermission.cs
- TextBox.cs
- InputScopeAttribute.cs
- BamlResourceSerializer.cs
- Lasso.cs
- HttpApplication.cs
- GridViewEditEventArgs.cs
- ProvidersHelper.cs
- BinaryMessageEncoder.cs
- XmlParserContext.cs
- ConnectionAcceptor.cs
- ProviderUtil.cs
- MimeWriter.cs
- AnonymousIdentificationSection.cs
- SymbolType.cs
- SrgsElementFactoryCompiler.cs
- TempFiles.cs
- SmtpReplyReaderFactory.cs
- CanExecuteRoutedEventArgs.cs
- TraceSwitch.cs
- IndexingContentUnit.cs
- DiagnosticEventProvider.cs
- BitmapFrameEncode.cs
- ToolStripSettings.cs
- RowToParametersTransformer.cs
- ErrorFormatter.cs
- SrgsToken.cs
- InternalPermissions.cs
- SByteStorage.cs
- ZipIOExtraFieldZip64Element.cs
- SoapMessage.cs
- XmlArrayItemAttribute.cs
- FlowPosition.cs
- WebSysDisplayNameAttribute.cs
- WorkItem.cs
- CharacterShapingProperties.cs
- Trace.cs
- UIElement.cs
- CodeParameterDeclarationExpressionCollection.cs
- DirtyTextRange.cs
- VectorCollection.cs