Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Shared / MS / Internal / GenericEnumerator.cs / 1 / GenericEnumerator.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2001 // // File: GenericEnumerator.cs //----------------------------------------------------------------------------- using System; using System.Collections; using System.Diagnostics; using System.Windows; using MS.Utility; #if PRESENTATION_CORE using SR=MS.Internal.PresentationCore.SR; using SRID=MS.Internal.PresentationCore.SRID; #else using SR=System.Windows.SR; using SRID=System.Windows.SRID; #endif namespace MS.Internal { ////// GenericEnumerator /// internal class GenericEnumerator : IEnumerator { #region Delegates internal delegate int GetGenerationIDDelegate(); #endregion #region Constructors private GenericEnumerator() { } internal GenericEnumerator(IList array, GetGenerationIDDelegate getGenerationID) { _array = array; _count = _array.Count; _position = -1; _getGenerationID = getGenerationID; _originalGenerationID = _getGenerationID(); } #endregion #region Private private void VerifyCurrent() { if ( (-1 == _position) || (_position >= _count)) { throw new InvalidOperationException(SR.Get(SRID.Enumerator_VerifyContext)); } } #endregion #region IEnumerator ////// Returns the object at the current location of the key times list. /// Use the strongly typed version instead. /// object IEnumerator.Current { get { VerifyCurrent(); return _current; } } ////// Move to the next value in the key times list /// ///true if succeeded, false if at the end of the list public bool MoveNext() { if (_getGenerationID() != _originalGenerationID) { throw new InvalidOperationException(SR.Get(SRID.Enumerator_CollectionChanged)); } _position++; if (_position >= _count) { _position = _count; return false; } else { Debug.Assert(_position >= 0); _current = _array[_position]; return true; } } ////// Move to the position before the first value in the list. /// public void Reset() { if (_getGenerationID() != _originalGenerationID) { throw new InvalidOperationException(SR.Get(SRID.Enumerator_CollectionChanged)); } else { _position = -1; } } #endregion #region Data private IList _array; private object _current; private int _count; private int _position; private int _originalGenerationID; private GetGenerationIDDelegate _getGenerationID; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- JsonQueryStringConverter.cs
- ToolStripSplitStackLayout.cs
- InternalDuplexBindingElement.cs
- DefaultSettingsSection.cs
- GenericArgumentsUpdater.cs
- SelectionEditingBehavior.cs
- WebControlsSection.cs
- SmtpTransport.cs
- BitVector32.cs
- DefaultBindingPropertyAttribute.cs
- CrossContextChannel.cs
- SqlUdtInfo.cs
- ChildrenQuery.cs
- PersonalizationEntry.cs
- ViewBase.cs
- ViewBase.cs
- UnaryNode.cs
- XmlSchemaSimpleContentExtension.cs
- Label.cs
- ZipIOExtraField.cs
- XPathScanner.cs
- DataContractFormatAttribute.cs
- DispatcherProcessingDisabled.cs
- SafeNativeMethods.cs
- VersionedStreamOwner.cs
- EditorZone.cs
- ErrorHandler.cs
- EndpointConfigContainer.cs
- WebHttpBindingElement.cs
- RepeaterItemEventArgs.cs
- AQNBuilder.cs
- SystemWebCachingSectionGroup.cs
- XamlStream.cs
- ClientConfigPaths.cs
- TagMapCollection.cs
- TiffBitmapDecoder.cs
- ObjectViewQueryResultData.cs
- unsafenativemethodsother.cs
- MatrixTransform.cs
- GenerateHelper.cs
- ClientApiGenerator.cs
- DeclarativeCatalogPart.cs
- ChildTable.cs
- Error.cs
- NetDataContractSerializer.cs
- XmlElementAttributes.cs
- FontUnitConverter.cs
- MasterPageParser.cs
- NumericUpDown.cs
- DataSourceView.cs
- ScalarType.cs
- VisualProxy.cs
- ProviderBase.cs
- SafeSecurityHandles.cs
- StructuralObject.cs
- StickyNoteAnnotations.cs
- RequestTimeoutManager.cs
- AutoCompleteStringCollection.cs
- UniqueConstraint.cs
- MarkupProperty.cs
- TokenBasedSet.cs
- Comparer.cs
- IntranetCredentialPolicy.cs
- EncoderParameters.cs
- externdll.cs
- SafeRegistryHandle.cs
- ZipIOLocalFileBlock.cs
- BrushValueSerializer.cs
- PropertyValueChangedEvent.cs
- DebugViewWriter.cs
- smtppermission.cs
- ExpressionConverter.cs
- BaseCodePageEncoding.cs
- Quaternion.cs
- PublisherIdentityPermission.cs
- HttpCookiesSection.cs
- InlineObject.cs
- XmlImplementation.cs
- DummyDataSource.cs
- Application.cs
- ImagingCache.cs
- Vector3D.cs
- CustomTypeDescriptor.cs
- BamlResourceDeserializer.cs
- Brushes.cs
- WebPartsPersonalizationAuthorization.cs
- VectorCollection.cs
- KernelTypeValidation.cs
- NameTable.cs
- AsyncContentLoadedEventArgs.cs
- ISAPIApplicationHost.cs
- XmlBindingWorker.cs
- RuntimeCompatibilityAttribute.cs
- XPathParser.cs
- SingleResultAttribute.cs
- SqlStatistics.cs
- Wow64ConfigurationLoader.cs
- TdsParserStateObject.cs
- Int32CollectionValueSerializer.cs
- ISessionStateStore.cs