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
- CompilerGlobalScopeAttribute.cs
- MediaSystem.cs
- HttpInputStream.cs
- ActivityBuilderHelper.cs
- ToolCreatedEventArgs.cs
- ContextDataSourceContextData.cs
- DefaultProxySection.cs
- ErrorWebPart.cs
- OleDbCommand.cs
- WindowsToolbar.cs
- ListViewCancelEventArgs.cs
- WebExceptionStatus.cs
- ScalarConstant.cs
- IPAddress.cs
- HtmlTableCell.cs
- Utils.cs
- TimersDescriptionAttribute.cs
- BaseProcessProtocolHandler.cs
- newinstructionaction.cs
- SQLUtility.cs
- GenericTextProperties.cs
- FixedElement.cs
- DynamicPropertyHolder.cs
- WebZone.cs
- ConnectionInterfaceCollection.cs
- SHA256.cs
- documentsequencetextpointer.cs
- DbConnectionPool.cs
- TextElement.cs
- PointCollection.cs
- XmlQueryRuntime.cs
- WebPartHeaderCloseVerb.cs
- OutArgumentConverter.cs
- CacheHelper.cs
- BitmapEffectCollection.cs
- Token.cs
- CommonDialog.cs
- OutputWindow.cs
- NativeMethods.cs
- ReadingWritingEntityEventArgs.cs
- ShowExpandedMultiValueConverter.cs
- RootBrowserWindowProxy.cs
- DataConnectionHelper.cs
- PropertyInformationCollection.cs
- MaterialGroup.cs
- CacheSection.cs
- XhtmlBasicLiteralTextAdapter.cs
- HandlerFactoryCache.cs
- ellipse.cs
- CommandEventArgs.cs
- EventProviderWriter.cs
- RotateTransform.cs
- UrlAuthFailedErrorFormatter.cs
- FieldDescriptor.cs
- SuppressIldasmAttribute.cs
- KeyboardEventArgs.cs
- PerformanceCounter.cs
- MarkupCompilePass1.cs
- TriggerAction.cs
- TableItemStyle.cs
- WorkflowNamespace.cs
- IPipelineRuntime.cs
- RadialGradientBrush.cs
- SchemaHelper.cs
- SafeArrayRankMismatchException.cs
- CurrentChangingEventArgs.cs
- ExpressionNode.cs
- InputLanguageCollection.cs
- HttpProcessUtility.cs
- CreateParams.cs
- WindowsTooltip.cs
- ImageList.cs
- SigningProgress.cs
- IdentitySection.cs
- SessionStateItemCollection.cs
- ServiceHostFactory.cs
- MoveSizeWinEventHandler.cs
- XmlSchemaValidator.cs
- TagPrefixInfo.cs
- PropertyEmitterBase.cs
- ByteKeyFrameCollection.cs
- ButtonPopupAdapter.cs
- WCFBuildProvider.cs
- DateTimeValueSerializer.cs
- ConfigurationManagerHelper.cs
- KeyedCollection.cs
- ChameleonKey.cs
- PropertyMap.cs
- ExpressionEvaluator.cs
- ServiceNotStartedException.cs
- HttpRequestCacheValidator.cs
- InheritanceService.cs
- ProcessRequestAsyncResult.cs
- XmlKeywords.cs
- ICspAsymmetricAlgorithm.cs
- IPAddressCollection.cs
- WebControlAdapter.cs
- QuotedPrintableStream.cs
- xmlsaver.cs
- SqlNodeAnnotations.cs