Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Linq / Parallel / QueryOperators / Inlined / InlinedAggregationOperatorEnumerator.cs / 1305376 / InlinedAggregationOperatorEnumerator.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ // // InlinedAggregationOperatorEnumerator.cs // //[....] // // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System.Threading; namespace System.Linq.Parallel { //---------------------------------------------------------------------------------------- // Inlined aggregate operators for finding the min/max values for primitives (int, long, float, // double, decimal). Versions are also offered for the nullable primitives (int?, long?, float?, // double?, decimal?), which differ slightly in behavior: they return a null value for empty // streams, whereas the ordinary primitive versions throw. // //--------------------------------------------------------------------------------------- // Inlined average operators for primitives (int, long, float, double, decimal), and the // nullable variants. The difference between the nromal and nullable variety is that // nulls are skipped in tallying the count and sum for the average. // ////// A class with some shared implementation between all aggregation enumerators. /// ///internal abstract class InlinedAggregationOperatorEnumerator : QueryOperatorEnumerator { private int m_partitionIndex; // This partition's unique index. protected CancellationToken m_cancellationToken; //--------------------------------------------------------------------------------------- // Instantiates a new aggregation operator. // internal InlinedAggregationOperatorEnumerator(int partitionIndex, CancellationToken cancellationToken) { m_partitionIndex = partitionIndex; m_cancellationToken = cancellationToken; } //--------------------------------------------------------------------------------------- // Tallies up the sum of the underlying data source, walking the entire thing the first // time MoveNext is called on this object. There is a boilerplate variant used by callers, // and then one that is used for extensibility by subclasses. // internal sealed override bool MoveNext(ref TIntermediate currentElement, ref int currentKey) { if (MoveNextCore(ref currentElement)) { // A reduction's "index" is the same as its partition number. currentKey = m_partitionIndex; return true; } return false; } protected abstract bool MoveNextCore(ref TIntermediate currentElement); } } // 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
- ProviderIncompatibleException.cs
- SymmetricCryptoHandle.cs
- Animatable.cs
- EmissiveMaterial.cs
- DbParameterCollectionHelper.cs
- UserControl.cs
- StrokeNode.cs
- PathGeometry.cs
- DirectoryObjectSecurity.cs
- IList.cs
- CodeTypeParameter.cs
- DependencyObjectProvider.cs
- XmlHierarchicalDataSourceView.cs
- ClickablePoint.cs
- InternalResources.cs
- FormDesigner.cs
- ButtonBaseAutomationPeer.cs
- XmlAnyAttributeAttribute.cs
- XmlSchemaSimpleTypeUnion.cs
- ExtentKey.cs
- TreeViewItem.cs
- IgnoreSection.cs
- FrameworkContextData.cs
- SmiEventSink.cs
- SqlAliaser.cs
- SQLSingleStorage.cs
- AspProxy.cs
- ToolStripAdornerWindowService.cs
- Overlapped.cs
- PersonalizationProvider.cs
- DbConnectionOptions.cs
- RunInstallerAttribute.cs
- TableAdapterManagerNameHandler.cs
- CellLabel.cs
- _ScatterGatherBuffers.cs
- HandleCollector.cs
- Helper.cs
- BlurEffect.cs
- StringAnimationBase.cs
- Transform3D.cs
- NonParentingControl.cs
- DataGridLinkButton.cs
- DtrList.cs
- CdpEqualityComparer.cs
- EnumMember.cs
- GridViewRowCollection.cs
- FactoryMaker.cs
- TdsRecordBufferSetter.cs
- Misc.cs
- BevelBitmapEffect.cs
- FrameworkElement.cs
- LedgerEntry.cs
- MulticastNotSupportedException.cs
- CodeObjectCreateExpression.cs
- ListBox.cs
- BStrWrapper.cs
- XmlSchemaInferenceException.cs
- FrameworkElementFactoryMarkupObject.cs
- DelimitedListTraceListener.cs
- WebPartZone.cs
- ManagementInstaller.cs
- Helper.cs
- XsltFunctions.cs
- FormClosingEvent.cs
- DateTimeValueSerializer.cs
- RadioButtonRenderer.cs
- CodeSubDirectory.cs
- ObfuscationAttribute.cs
- ModelUIElement3D.cs
- CategoryGridEntry.cs
- DuplexChannel.cs
- SoapAttributes.cs
- ScriptingSectionGroup.cs
- MultiDataTrigger.cs
- ClosureBinding.cs
- JavaScriptObjectDeserializer.cs
- ZipIOLocalFileDataDescriptor.cs
- MapPathBasedVirtualPathProvider.cs
- ExpressionBuilder.cs
- contentDescriptor.cs
- TextBounds.cs
- PagesChangedEventArgs.cs
- InstancePersistenceEvent.cs
- SplayTreeNode.cs
- EventRecord.cs
- PrintController.cs
- FileUpload.cs
- ParsedAttributeCollection.cs
- HttpResponseWrapper.cs
- CompilerTypeWithParams.cs
- OleAutBinder.cs
- DoubleSumAggregationOperator.cs
- OrderByQueryOptionExpression.cs
- DataFieldCollectionEditor.cs
- ResizingMessageFilter.cs
- SqlProvider.cs
- DateTimeSerializationSection.cs
- BoolLiteral.cs
- XPathNavigatorKeyComparer.cs
- XmlUtilWriter.cs