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
- TransformerInfo.cs
- IntSecurity.cs
- IisTraceWebEventProvider.cs
- SqlNotificationEventArgs.cs
- TypefaceCollection.cs
- RegexCaptureCollection.cs
- PropertyGrid.cs
- Enlistment.cs
- ObjectHelper.cs
- PropertyDescriptor.cs
- METAHEADER.cs
- NavigationService.cs
- SqlTriggerAttribute.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- ParenthesizePropertyNameAttribute.cs
- ReflectPropertyDescriptor.cs
- HtmlInputControl.cs
- ViewKeyConstraint.cs
- TraceContextEventArgs.cs
- FileUtil.cs
- MenuBase.cs
- MatrixAnimationBase.cs
- CompositeFontInfo.cs
- StaticSiteMapProvider.cs
- HttpBufferlessInputStream.cs
- StandardOleMarshalObject.cs
- SafeFindHandle.cs
- IIS7UserPrincipal.cs
- AuthorizationRuleCollection.cs
- QilStrConcat.cs
- SerializationObjectManager.cs
- ExpressionWriter.cs
- XdrBuilder.cs
- StubHelpers.cs
- XPathCompileException.cs
- QuaternionAnimation.cs
- NumericPagerField.cs
- DefaultCompensation.cs
- SimpleRecyclingCache.cs
- SoapObjectInfo.cs
- QuerySafeNavigator.cs
- X509Certificate.cs
- Odbc32.cs
- PagedControl.cs
- ControlFilterExpression.cs
- TypeBrowserDialog.cs
- WindowsComboBox.cs
- RowToFieldTransformer.cs
- TypeEnumerableViewSchema.cs
- XmlDownloadManager.cs
- LabelExpression.cs
- StringPropertyBuilder.cs
- XmlAttributeCollection.cs
- TypeConverterAttribute.cs
- DBParameter.cs
- SearchForVirtualItemEventArgs.cs
- SapiGrammar.cs
- Substitution.cs
- MemoryMappedViewAccessor.cs
- Converter.cs
- HitTestParameters.cs
- DeriveBytes.cs
- UICuesEvent.cs
- EncryptedKeyHashIdentifierClause.cs
- ContractInstanceProvider.cs
- FlowDocumentReaderAutomationPeer.cs
- RemoteWebConfigurationHostStream.cs
- ElementAtQueryOperator.cs
- TimelineGroup.cs
- AlignmentXValidation.cs
- TargetException.cs
- TCEAdapterGenerator.cs
- ArithmeticException.cs
- BindingSource.cs
- VisualStyleRenderer.cs
- ByteStack.cs
- LockCookie.cs
- ValidationRuleCollection.cs
- ToolBarButtonClickEvent.cs
- DocumentViewerBaseAutomationPeer.cs
- HttpServerUtilityBase.cs
- DependencyPropertyChangedEventArgs.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- Point4D.cs
- TextServicesCompartmentContext.cs
- CultureInfoConverter.cs
- CommonDialog.cs
- TypeToken.cs
- WebConfigurationManager.cs
- BinaryFormatter.cs
- HtmlImage.cs
- VisualTreeHelper.cs
- CodeFieldReferenceExpression.cs
- RotateTransform3D.cs
- WebPart.cs
- Base64Stream.cs
- ExtendedProtectionPolicy.cs
- TableRowCollection.cs
- Symbol.cs
- SimpleHandlerFactory.cs