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
- ReflectEventDescriptor.cs
- TransformationRules.cs
- TreeNodeStyleCollection.cs
- ErrorProvider.cs
- IdentityHolder.cs
- HtmlInputSubmit.cs
- PageCodeDomTreeGenerator.cs
- TraceContextRecord.cs
- SystemIPv4InterfaceProperties.cs
- ScrollContentPresenter.cs
- TransactionChannelListener.cs
- XsdDuration.cs
- ObjectAnimationBase.cs
- HttpHandlerActionCollection.cs
- PenCursorManager.cs
- DataSourceSelectArguments.cs
- SqlGatherConsumedAliases.cs
- PaperSource.cs
- DataColumnChangeEvent.cs
- LinqDataSourceHelper.cs
- XmlSchemaAny.cs
- TextAdaptor.cs
- PrinterSettings.cs
- Token.cs
- SqlConnectionHelper.cs
- ExpressionEditorAttribute.cs
- CodeTypeMemberCollection.cs
- FloaterBaseParagraph.cs
- ClickablePoint.cs
- SerializationInfoEnumerator.cs
- QuotedPrintableStream.cs
- BatchParser.cs
- XmlWriterSettings.cs
- Size.cs
- SelectQueryOperator.cs
- ChannelServices.cs
- ListViewGroupCollectionEditor.cs
- NestPullup.cs
- HttpListenerException.cs
- HttpServerVarsCollection.cs
- PageCache.cs
- Queue.cs
- GridProviderWrapper.cs
- ToolStripPanelRow.cs
- ScriptControlDescriptor.cs
- InstanceOwnerQueryResult.cs
- CompilationRelaxations.cs
- ReadContentAsBinaryHelper.cs
- DataError.cs
- TextDecorationLocationValidation.cs
- CodeBinaryOperatorExpression.cs
- SafeEventLogReadHandle.cs
- ViewCellSlot.cs
- PolicyManager.cs
- SettingsPropertyValue.cs
- BulletedList.cs
- Message.cs
- RequestCacheManager.cs
- TemplatedEditableDesignerRegion.cs
- SessionStateItemCollection.cs
- SettingsAttributes.cs
- RoleService.cs
- IntSecurity.cs
- KeyFrames.cs
- MemberListBinding.cs
- GridPatternIdentifiers.cs
- SplitterCancelEvent.cs
- LogWriteRestartAreaAsyncResult.cs
- Compiler.cs
- Process.cs
- TraceUtility.cs
- FileEnumerator.cs
- EditCommandColumn.cs
- ConfigXmlSignificantWhitespace.cs
- XmlSchemaParticle.cs
- RemotingConfiguration.cs
- OperatorExpressions.cs
- Validator.cs
- CustomErrorsSectionWrapper.cs
- OdbcDataReader.cs
- NullableIntAverageAggregationOperator.cs
- ColumnMapCopier.cs
- AtomParser.cs
- SqlBuilder.cs
- CheckBoxField.cs
- VirtualizedItemProviderWrapper.cs
- SafeEventHandle.cs
- FileInfo.cs
- WebResourceAttribute.cs
- DoubleUtil.cs
- WebBrowserHelper.cs
- WindowVisualStateTracker.cs
- XpsPackagingException.cs
- SplineKeyFrames.cs
- ListItemCollection.cs
- SmiXetterAccessMap.cs
- TemplateManager.cs
- MailMessageEventArgs.cs
- TransactionFilter.cs
- Misc.cs