Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Linq / Parallel / Enumerables / EmptyEnumerable.cs / 1305376 / EmptyEnumerable.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ // // EmptyEnumerable.cs // //[....] // // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System.Collections; using System.Collections.Generic; namespace System.Linq.Parallel { ////// We occ----ionally need a no-op enumerator to stand-in when we don't have data left /// within a partition's data stream. These are simple enumerable and enumerator /// implementations that always and consistently yield no elements. /// ///internal class EmptyEnumerable : ParallelQuery { private EmptyEnumerable() : base(QuerySettings.Empty) { } // A singleton cached and shared among callers. private static EmptyEnumerable s_instance; private static EmptyEnumerator s_enumeratorInstance; internal static EmptyEnumerable Instance { get { if (s_instance == null) { // There is no need for thread safety here. s_instance = new EmptyEnumerable (); } return s_instance; } } public override IEnumerator GetEnumerator() { if (s_enumeratorInstance == null) { // There is no need for thread safety here. s_enumeratorInstance = new EmptyEnumerator (); } return s_enumeratorInstance; } } internal class EmptyEnumerator : QueryOperatorEnumerator , IEnumerator { internal override bool MoveNext(ref T currentElement, ref int currentKey) { return false; } // IEnumerator methods. public T Current { get { return default(T); } } object IEnumerator.Current { get { return null; } } public bool MoveNext() { return false; } void Collections.IEnumerator.Reset() { } } } // 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
- InternalPermissions.cs
- DataGridViewColumnConverter.cs
- GeneratedCodeAttribute.cs
- DesignerOptionService.cs
- FontFamily.cs
- ContourSegment.cs
- AspNetRouteServiceHttpHandler.cs
- Publisher.cs
- GenericWebPart.cs
- UrlPropertyAttribute.cs
- CultureInfoConverter.cs
- panel.cs
- XamlSerializerUtil.cs
- DataGridViewRowPostPaintEventArgs.cs
- GreenMethods.cs
- CallbackHandler.cs
- FullTextLine.cs
- ComNativeDescriptor.cs
- NCryptSafeHandles.cs
- ServiceHttpHandlerFactory.cs
- Baml2006ReaderContext.cs
- ServiceObjectContainer.cs
- TiffBitmapEncoder.cs
- WebColorConverter.cs
- SiteMapNodeItemEventArgs.cs
- DrawListViewSubItemEventArgs.cs
- TextBreakpoint.cs
- TextParaClient.cs
- ToolStripRenderEventArgs.cs
- ISAPIApplicationHost.cs
- ClientApiGenerator.cs
- ImageAnimator.cs
- DrawingVisualDrawingContext.cs
- XPathSingletonIterator.cs
- ConfigViewGenerator.cs
- CultureInfo.cs
- ProgressChangedEventArgs.cs
- ConstructorNeedsTagAttribute.cs
- ListViewItemMouseHoverEvent.cs
- XmlSchemaSimpleContent.cs
- DeclarativeCatalogPart.cs
- RepeatButtonAutomationPeer.cs
- TemplateColumn.cs
- GestureRecognitionResult.cs
- Int32Rect.cs
- IntSecurity.cs
- IndependentlyAnimatedPropertyMetadata.cs
- DataKey.cs
- SimpleLine.cs
- NavigationHelper.cs
- TextHidden.cs
- CatalogPartChrome.cs
- SecurityState.cs
- DebuggerAttributes.cs
- SplashScreenNativeMethods.cs
- ToolStripDropDownMenu.cs
- AuthenticatedStream.cs
- SafeFileMappingHandle.cs
- CategoryNameCollection.cs
- EventSinkActivityDesigner.cs
- TagPrefixInfo.cs
- PerfService.cs
- XmlNamespaceDeclarationsAttribute.cs
- WindowsToolbar.cs
- SymLanguageVendor.cs
- CodeTypeParameter.cs
- QilFactory.cs
- SQLDateTime.cs
- UdpDiscoveryEndpointElement.cs
- CodePageEncoding.cs
- SymmetricKeyWrap.cs
- BulletedListDesigner.cs
- WebEventCodes.cs
- LineServices.cs
- BCLDebug.cs
- WindowShowOrOpenTracker.cs
- MemberAccessException.cs
- DataError.cs
- HtmlAnchor.cs
- Typography.cs
- HtmlContainerControl.cs
- CodeGotoStatement.cs
- CheckBoxFlatAdapter.cs
- TraversalRequest.cs
- DesignerSerializationVisibilityAttribute.cs
- BooleanToVisibilityConverter.cs
- MenuItemCollection.cs
- SoundPlayer.cs
- WebBrowser.cs
- ChoiceConverter.cs
- DependencyObject.cs
- FastPropertyAccessor.cs
- FrameworkElementFactory.cs
- DataGridRowHeader.cs
- DataBinding.cs
- HttpContextServiceHost.cs
- PagedControl.cs
- SchemaTableOptionalColumn.cs
- RenderData.cs
- PermissionSetEnumerator.cs