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
- AssemblyBuilder.cs
- EventLogInformation.cs
- TrackingRecord.cs
- StylusPlugInCollection.cs
- ColumnClickEvent.cs
- SyndicationSerializer.cs
- FixUpCollection.cs
- AtomMaterializer.cs
- DetailsViewDeletedEventArgs.cs
- BinaryFormatter.cs
- DecoderNLS.cs
- BoundsDrawingContextWalker.cs
- Point3DAnimationBase.cs
- CharStorage.cs
- ResourceDictionary.cs
- TableStyle.cs
- TCPClient.cs
- RowsCopiedEventArgs.cs
- SyndicationSerializer.cs
- JulianCalendar.cs
- CheckoutException.cs
- Matrix3DValueSerializer.cs
- SafeRightsManagementPubHandle.cs
- MaterialCollection.cs
- ExtenderControl.cs
- InvalidCastException.cs
- RequestValidator.cs
- AspNetHostingPermission.cs
- FileNotFoundException.cs
- TableCell.cs
- MetadataProperty.cs
- SecurityTokenException.cs
- CheckBoxField.cs
- ColorConverter.cs
- InheritanceContextChangedEventManager.cs
- ScrollBar.cs
- ImageListStreamer.cs
- TraceLevelStore.cs
- ImageFormat.cs
- CodeVariableReferenceExpression.cs
- StrokeNodeEnumerator.cs
- RowToFieldTransformer.cs
- PropertyGridCommands.cs
- TypeDelegator.cs
- CultureTable.cs
- C14NUtil.cs
- NumericPagerField.cs
- ZipIOLocalFileHeader.cs
- KerberosSecurityTokenAuthenticator.cs
- FtpWebResponse.cs
- CodeFieldReferenceExpression.cs
- Literal.cs
- UrlPath.cs
- SchemaImporterExtensionsSection.cs
- WhitespaceRuleReader.cs
- CellParaClient.cs
- Accessible.cs
- WebPartTracker.cs
- AsyncResult.cs
- KerberosReceiverSecurityToken.cs
- ISO2022Encoding.cs
- DebugView.cs
- DispatcherObject.cs
- CounterCreationDataConverter.cs
- RelationshipManager.cs
- unsafeIndexingFilterStream.cs
- ViewStateChangedEventArgs.cs
- DateBoldEvent.cs
- PolicyException.cs
- DataGridViewLinkColumn.cs
- CompilerGeneratedAttribute.cs
- BaseProcessor.cs
- ConstructorNeedsTagAttribute.cs
- LineMetrics.cs
- BuildProvidersCompiler.cs
- UInt16Converter.cs
- MobileResource.cs
- OLEDB_Util.cs
- SafeSecurityHandles.cs
- StrongNameMembershipCondition.cs
- IIS7UserPrincipal.cs
- DataServiceHost.cs
- WindowHelperService.cs
- basecomparevalidator.cs
- ConvertEvent.cs
- UniformGrid.cs
- MethodCallConverter.cs
- QilXmlReader.cs
- ProbeMatchesCD1.cs
- ReadOnlyPermissionSet.cs
- NamespaceCollection.cs
- NavigateEvent.cs
- ControlCollection.cs
- CharacterMetrics.cs
- __Error.cs
- FlagsAttribute.cs
- ContentOperations.cs
- Typography.cs
- Guid.cs
- HasCopySemanticsAttribute.cs