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
- XmlRawWriter.cs
- SchemaMerger.cs
- SQLBytesStorage.cs
- ToolStripContainer.cs
- InternalConfigEventArgs.cs
- ResourceExpressionBuilder.cs
- SQLConvert.cs
- ToolboxItemAttribute.cs
- DeploymentExceptionMapper.cs
- FontSource.cs
- autovalidator.cs
- AssemblyName.cs
- PropertyGridView.cs
- TargetInvocationException.cs
- PiiTraceSource.cs
- DescendentsWalker.cs
- DeclaredTypeElement.cs
- RuleSettings.cs
- TraceContextEventArgs.cs
- ThreadLocal.cs
- ProvidersHelper.cs
- TextElementCollectionHelper.cs
- ComponentRenameEvent.cs
- EnvironmentPermission.cs
- DataSetUtil.cs
- UndoManager.cs
- DebugHandleTracker.cs
- TemplateNameScope.cs
- IncrementalHitTester.cs
- CodeRemoveEventStatement.cs
- TextServicesLoader.cs
- DragEvent.cs
- XmlValidatingReaderImpl.cs
- DebuggerService.cs
- FunctionDescription.cs
- FlowchartDesigner.xaml.cs
- EngineSite.cs
- Code.cs
- CodeIterationStatement.cs
- HttpVersion.cs
- InkPresenter.cs
- TaskbarItemInfo.cs
- EntityDesignerUtils.cs
- PaintValueEventArgs.cs
- StorageComplexPropertyMapping.cs
- RtfNavigator.cs
- CommandConverter.cs
- CounterCreationDataCollection.cs
- UIPropertyMetadata.cs
- FixedSOMLineRanges.cs
- FreezableOperations.cs
- ListViewItem.cs
- DateTimeUtil.cs
- WorkflowServiceHostFactory.cs
- NameSpaceExtractor.cs
- SHA256Managed.cs
- FacetChecker.cs
- SQLDecimal.cs
- VariantWrapper.cs
- MouseButton.cs
- XmlSignificantWhitespace.cs
- metadatamappinghashervisitor.cs
- DependencyProperty.cs
- ContentDesigner.cs
- contentDescriptor.cs
- PasswordValidationException.cs
- WebMessageBodyStyleHelper.cs
- GeneralTransform2DTo3D.cs
- ObjectTag.cs
- SessionPageStateSection.cs
- ToolStripCollectionEditor.cs
- RectangleGeometry.cs
- KeyMatchBuilder.cs
- RootContext.cs
- SymbolMethod.cs
- BasicViewGenerator.cs
- TextEditorTables.cs
- BooleanProjectedSlot.cs
- COM2ExtendedTypeConverter.cs
- ItemCollection.cs
- XPathDocumentIterator.cs
- LocalizeDesigner.cs
- ConvertersCollection.cs
- TextMetrics.cs
- TemplatedWizardStep.cs
- Globals.cs
- DynamicDataResources.Designer.cs
- FamilyCollection.cs
- ObjectStateEntry.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- StylusButton.cs
- OleDragDropHandler.cs
- wgx_sdk_version.cs
- DataSourceDesigner.cs
- RIPEMD160.cs
- Privilege.cs
- CacheManager.cs
- ContentElementAutomationPeer.cs
- HandlerElementCollection.cs
- arclist.cs