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
- EndOfStreamException.cs
- XmlMembersMapping.cs
- FontInfo.cs
- MessageSmuggler.cs
- DecoderBestFitFallback.cs
- Registry.cs
- SqlRewriteScalarSubqueries.cs
- RepeatBehavior.cs
- SiteOfOriginPart.cs
- FileSystemInfo.cs
- Mapping.cs
- HandoffBehavior.cs
- PropertyInformationCollection.cs
- ImageListUtils.cs
- CapabilitiesSection.cs
- DataGridViewTextBoxColumn.cs
- LoginView.cs
- SystemTcpStatistics.cs
- CodeVariableReferenceExpression.cs
- CacheRequest.cs
- DataListItem.cs
- documentsequencetextpointer.cs
- SuppressMessageAttribute.cs
- DocumentViewerBase.cs
- KnownColorTable.cs
- ObjectConverter.cs
- CompilerTypeWithParams.cs
- Span.cs
- OracleParameter.cs
- ComAdminWrapper.cs
- PageSetupDialog.cs
- LinkLabelLinkClickedEvent.cs
- CapabilitiesPattern.cs
- EditCommandColumn.cs
- FactoryGenerator.cs
- DataGridViewToolTip.cs
- QueryInterceptorAttribute.cs
- BuildManager.cs
- ToolStripSystemRenderer.cs
- FrameworkContentElement.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- XmlSchemaExternal.cs
- ControlType.cs
- HijriCalendar.cs
- IsolatedStorageFilePermission.cs
- XmlSchemaElement.cs
- ListComponentEditorPage.cs
- UnitySerializationHolder.cs
- SegmentInfo.cs
- AutoCompleteStringCollection.cs
- WebPartMovingEventArgs.cs
- XamlClipboardData.cs
- XPathCompileException.cs
- XmlSchemaImport.cs
- ObjectViewListener.cs
- ContractUtils.cs
- StylusPointCollection.cs
- LowerCaseStringConverter.cs
- CommandField.cs
- basenumberconverter.cs
- CmsUtils.cs
- XmlSchemaChoice.cs
- SqlComparer.cs
- LinkedResource.cs
- NotifyParentPropertyAttribute.cs
- BitmapEffectInputConnector.cs
- SymbolType.cs
- XmlFormatExtensionAttribute.cs
- TrustLevelCollection.cs
- Tile.cs
- ServiceTimeoutsBehavior.cs
- Annotation.cs
- SemaphoreFullException.cs
- grammarelement.cs
- DbProviderFactories.cs
- BulletChrome.cs
- EditingContext.cs
- versioninfo.cs
- IntSecurity.cs
- ResXResourceReader.cs
- ExpressionVisitor.cs
- KeyedQueue.cs
- XmlQueryContext.cs
- SqlTypesSchemaImporter.cs
- WinCategoryAttribute.cs
- WebPartConnection.cs
- Floater.cs
- AnimationLayer.cs
- MachineKeyConverter.cs
- JournalEntryListConverter.cs
- VariableQuery.cs
- XPathQilFactory.cs
- IntegerValidatorAttribute.cs
- StylusSystemGestureEventArgs.cs
- ClientFormsAuthenticationCredentials.cs
- TextRangeEditTables.cs
- COM2PropertyDescriptor.cs
- ModelItemImpl.cs
- Style.cs
- StringCollection.cs