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
- FlowDocumentScrollViewer.cs
- TextAutomationPeer.cs
- HtmlSelect.cs
- TextFormatterImp.cs
- DebuggerAttributes.cs
- ShimAsPublicXamlType.cs
- DataGridViewHitTestInfo.cs
- Profiler.cs
- StorageMappingItemCollection.cs
- BorderSidesEditor.cs
- RootDesignerSerializerAttribute.cs
- Baml2006ReaderSettings.cs
- CollectionBase.cs
- OutputCacheSettingsSection.cs
- ToolStripButton.cs
- TreeViewEvent.cs
- SqlComparer.cs
- EventSinkActivity.cs
- SmtpAuthenticationManager.cs
- DataGridViewSelectedRowCollection.cs
- TypeGeneratedEventArgs.cs
- ThreadExceptionDialog.cs
- HwndKeyboardInputProvider.cs
- Helper.cs
- Profiler.cs
- CollectionTypeElement.cs
- WebBaseEventKeyComparer.cs
- FixedSOMPageConstructor.cs
- XmlPreloadedResolver.cs
- NativeWindow.cs
- Listbox.cs
- DynamicResourceExtensionConverter.cs
- RegexTree.cs
- KerberosReceiverSecurityToken.cs
- DataContractJsonSerializer.cs
- SequentialActivityDesigner.cs
- MsmqHostedTransportConfiguration.cs
- clipboard.cs
- TimeZoneInfo.cs
- DesignerCalendarAdapter.cs
- DataGridViewCellValidatingEventArgs.cs
- DataTablePropertyDescriptor.cs
- NotImplementedException.cs
- Psha1DerivedKeyGenerator.cs
- OutOfMemoryException.cs
- BCLDebug.cs
- _NtlmClient.cs
- CachingHintValidation.cs
- PlainXmlSerializer.cs
- SiteMapDataSourceDesigner.cs
- SystemException.cs
- Itemizer.cs
- WebPartCancelEventArgs.cs
- BindingMemberInfo.cs
- MethodBuilderInstantiation.cs
- RenderContext.cs
- ButtonField.cs
- MarkupCompiler.cs
- Activator.cs
- SocketException.cs
- OutArgument.cs
- WindowsButton.cs
- xdrvalidator.cs
- ProfileProvider.cs
- ExclusiveCanonicalizationTransform.cs
- Psha1DerivedKeyGeneratorHelper.cs
- XmlImplementation.cs
- MsmqOutputMessage.cs
- NamespaceInfo.cs
- SemanticTag.cs
- _PooledStream.cs
- __Filters.cs
- FormatVersion.cs
- LogicalExpr.cs
- XhtmlConformanceSection.cs
- CacheSection.cs
- CodeTryCatchFinallyStatement.cs
- XmlWriter.cs
- InstanceHandleConflictException.cs
- TypeViewSchema.cs
- ResourceLoader.cs
- HttpCachePolicy.cs
- Utils.cs
- CompilerWrapper.cs
- ConnectionStringsExpressionBuilder.cs
- StoreItemCollection.Loader.cs
- ModelService.cs
- CounterCreationDataConverter.cs
- MergeLocalizationDirectives.cs
- ReadOnlyHierarchicalDataSource.cs
- ConnectorRouter.cs
- Regex.cs
- BaseTemplateBuildProvider.cs
- ExpandSegment.cs
- DataFormats.cs
- OracleDataAdapter.cs
- GridViewRowEventArgs.cs
- XmlMtomWriter.cs
- JsonGlobals.cs
- WsatConfiguration.cs