Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Query / InternalTrees / NodeCounter.cs / 1305376 / NodeCounter.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Globalization; using System.Diagnostics; using System.Data.Common; using md=System.Data.Metadata.Edm; namespace System.Data.Query.InternalTrees { ////// Counts the number of nodes in a tree /// internal class NodeCounter : BasicOpVisitorOfT{ /// /// Public entry point - Calculates the nubmer of nodes in the given subTree /// /// ///internal static int Count(Node subTree) { NodeCounter counter = new NodeCounter(); return counter.VisitNode(subTree); } /// /// Common processing for all node types /// Count = 1 (self) + count of children /// /// ///protected override int VisitDefault(Node n) { int count = 1; foreach (Node child in n.Children) { count += VisitNode(child); } return count; } } } // 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
- RequiredAttributeAttribute.cs
- ImageClickEventArgs.cs
- LocalizableResourceBuilder.cs
- BitmapFrame.cs
- Util.cs
- TableStyle.cs
- HttpException.cs
- IApplicationTrustManager.cs
- Vector3DAnimation.cs
- ExpandoClass.cs
- XmlSignatureProperties.cs
- ApplicationInfo.cs
- DataGridViewMethods.cs
- ReachDocumentPageSerializerAsync.cs
- ResourceAttributes.cs
- ToolBar.cs
- RegexCaptureCollection.cs
- TailCallAnalyzer.cs
- RuntimeWrappedException.cs
- ListView.cs
- SecurityDocument.cs
- BaseCollection.cs
- ToolStripSettings.cs
- GenericsNotImplementedException.cs
- AssemblyBuilder.cs
- DataServiceHostFactory.cs
- SqlProfileProvider.cs
- IQueryable.cs
- DirectoryObjectSecurity.cs
- CfgSemanticTag.cs
- TrackingRecord.cs
- DeviceContext.cs
- XmlDataCollection.cs
- MissingSatelliteAssemblyException.cs
- VBIdentifierName.cs
- ProfileService.cs
- ConstraintEnumerator.cs
- InputDevice.cs
- StorageEntityContainerMapping.cs
- ExplicitDiscriminatorMap.cs
- TraceData.cs
- IIS7UserPrincipal.cs
- RichTextBoxConstants.cs
- Messages.cs
- IdentifierElement.cs
- BinHexEncoder.cs
- PropertyMetadata.cs
- CommonProperties.cs
- SymLanguageVendor.cs
- dataprotectionpermission.cs
- DataPagerField.cs
- ScrollChrome.cs
- SelectorAutomationPeer.cs
- PrintEvent.cs
- TextCompositionEventArgs.cs
- DataGridViewHitTestInfo.cs
- NavigationHelper.cs
- AsyncStreamReader.cs
- SafeHandles.cs
- IndexedString.cs
- SortFieldComparer.cs
- ToolStripPanelRow.cs
- TextSearch.cs
- ToolStripManager.cs
- QueryActivatableWorkflowsCommand.cs
- XmlSchemaCompilationSettings.cs
- BitVector32.cs
- GeneralTransform3DTo2D.cs
- NominalTypeEliminator.cs
- cookie.cs
- CharEnumerator.cs
- StringStorage.cs
- RegexStringValidatorAttribute.cs
- TCPClient.cs
- SHA1CryptoServiceProvider.cs
- IdentitySection.cs
- InvokeProviderWrapper.cs
- DesignerOptionService.cs
- NamedPipeAppDomainProtocolHandler.cs
- UnknownMessageReceivedEventArgs.cs
- CollectionMarkupSerializer.cs
- ISAPIApplicationHost.cs
- GlobalizationSection.cs
- BrowserCapabilitiesFactory35.cs
- COM2PictureConverter.cs
- PropertyMap.cs
- FontWeights.cs
- ComponentManagerBroker.cs
- RootDesignerSerializerAttribute.cs
- EncryptedKey.cs
- CheckBoxField.cs
- DrawingBrush.cs
- ObjectSet.cs
- ObjectSet.cs
- ConnectionStringsExpressionBuilder.cs
- EncoderNLS.cs
- TableAdapterManagerHelper.cs
- WindowsRichEditRange.cs
- SourceFileBuildProvider.cs
- HttpHandler.cs