Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / ComponentModel / ArraySubsetEnumerator.cs / 1 / ArraySubsetEnumerator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.ComponentModel { using System; using System.Collections; using System.Diagnostics; using System.Security.Permissions; [HostProtection(SharedState = true)] internal class ArraySubsetEnumerator : IEnumerator { private Array array; private int total; private int current; public ArraySubsetEnumerator(Array array, int count) { Debug.Assert(count == 0 || array != null, "if array is null, count should be 0"); Debug.Assert(array == null || count <= array.Length, "Trying to enumerate more than the array contains"); this.array = array; this.total = count; current = -1; } public bool MoveNext() { if (current < total - 1) { current++; return true; } else { return false; } } public void Reset() { current = -1; } public object Current { get { if (current == -1) { throw new InvalidOperationException(); } else { return array.GetValue(current); } } } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PenContexts.cs
- PolicyException.cs
- TreeNode.cs
- DispatcherEventArgs.cs
- DrawingState.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- CriticalFinalizerObject.cs
- RectangleConverter.cs
- ZoneIdentityPermission.cs
- ResXResourceSet.cs
- Parser.cs
- ContentHostHelper.cs
- util.cs
- ListCollectionView.cs
- ItemContainerGenerator.cs
- WebPartDisplayModeCancelEventArgs.cs
- CompositeControl.cs
- Missing.cs
- SQLMembershipProvider.cs
- CompositionTarget.cs
- PathGeometry.cs
- ComponentEditorForm.cs
- Collection.cs
- InitializerFacet.cs
- FacetChecker.cs
- DynamicAttribute.cs
- DeflateStream.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- TextProperties.cs
- TabControl.cs
- EventLogEntry.cs
- columnmapfactory.cs
- ProfessionalColors.cs
- RegistryKey.cs
- FrameworkElementAutomationPeer.cs
- HttpPostedFile.cs
- FileDialogPermission.cs
- AnimatedTypeHelpers.cs
- ProgressBarHighlightConverter.cs
- ContextMarshalException.cs
- Attributes.cs
- SystemIPAddressInformation.cs
- DesignerSerializationOptionsAttribute.cs
- SmiMetaDataProperty.cs
- InteropAutomationProvider.cs
- MessageEventSubscriptionService.cs
- GcHandle.cs
- DesignerCategoryAttribute.cs
- OlePropertyStructs.cs
- WebPartExportVerb.cs
- EnumerationRangeValidationUtil.cs
- GeneralTransform3DGroup.cs
- Overlapped.cs
- PropertyTabAttribute.cs
- XmlUtf8RawTextWriter.cs
- BookmarkEventArgs.cs
- FieldNameLookup.cs
- ContentElement.cs
- DecoratedNameAttribute.cs
- ObjectParameterCollection.cs
- HttpWebRequestElement.cs
- SqlTransaction.cs
- ToolStripDropDownMenu.cs
- XPathNodePointer.cs
- HotSpot.cs
- AssemblyFilter.cs
- OuterGlowBitmapEffect.cs
- SplitContainer.cs
- SamlSecurityToken.cs
- EventListener.cs
- ContentValidator.cs
- WebConfigurationHost.cs
- XmlBinaryReader.cs
- ObjectNotFoundException.cs
- PngBitmapDecoder.cs
- TreeViewItemAutomationPeer.cs
- CompilerScope.Storage.cs
- X509Certificate2.cs
- PersonalizationState.cs
- DataViewSetting.cs
- BuildResultCache.cs
- datacache.cs
- CredentialCache.cs
- _SslState.cs
- StorageComplexTypeMapping.cs
- SelectionBorderGlyph.cs
- ButtonAutomationPeer.cs
- ConcurrentQueue.cs
- SqlFunctionAttribute.cs
- EnumDataContract.cs
- ListBoxAutomationPeer.cs
- FormsAuthenticationModule.cs
- HttpCacheVary.cs
- BulletedListEventArgs.cs
- SHA384Managed.cs
- _UncName.cs
- DESCryptoServiceProvider.cs
- StaticTextPointer.cs
- Thickness.cs
- ResourcesGenerator.cs