Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TagPrefixInfo.cs
- TypeToStringValueConverter.cs
- activationcontext.cs
- MasterPageCodeDomTreeGenerator.cs
- KeyedQueue.cs
- OptimalBreakSession.cs
- WebPartDescription.cs
- DesignerExtenders.cs
- WebPartEventArgs.cs
- Matrix.cs
- PopupEventArgs.cs
- SystemException.cs
- ValueUtilsSmi.cs
- PageRouteHandler.cs
- SafeTimerHandle.cs
- SynchronizationScope.cs
- StorageMappingItemLoader.cs
- NumericExpr.cs
- MSG.cs
- QuotedPrintableStream.cs
- SchemaCollectionCompiler.cs
- InkCanvasAutomationPeer.cs
- SqlWorkflowInstanceStore.cs
- DataSourceControl.cs
- TextPointer.cs
- LabelAutomationPeer.cs
- LineSegment.cs
- PrincipalPermission.cs
- ItemAutomationPeer.cs
- SmiEventSink_Default.cs
- RSACryptoServiceProvider.cs
- LocalizeDesigner.cs
- RawStylusInputCustomData.cs
- DriveNotFoundException.cs
- Button.cs
- XmlWriterTraceListener.cs
- PartEditor.cs
- LoginCancelEventArgs.cs
- XhtmlTextWriter.cs
- ItemCheckedEvent.cs
- ValidatingPropertiesEventArgs.cs
- MapPathBasedVirtualPathProvider.cs
- _FtpControlStream.cs
- ConstraintConverter.cs
- StorageAssociationSetMapping.cs
- DependencyObjectType.cs
- WebPartAuthorizationEventArgs.cs
- Transform3DGroup.cs
- UxThemeWrapper.cs
- PixelFormat.cs
- BaseAsyncResult.cs
- XmlQueryRuntime.cs
- InfoCard.cs
- SqlUtils.cs
- HttpRequestCacheValidator.cs
- XmlDataLoader.cs
- UIAgentAsyncBeginRequest.cs
- PolicyException.cs
- ClientSettingsStore.cs
- EventProxy.cs
- LinkLabelLinkClickedEvent.cs
- WmiPutTraceRecord.cs
- PeerNameRecord.cs
- HttpHandler.cs
- LifetimeServices.cs
- StatusStrip.cs
- QueryGeneratorBase.cs
- PersistenceContextEnlistment.cs
- SspiNegotiationTokenProvider.cs
- ColorContext.cs
- XPathItem.cs
- RadioButtonList.cs
- SessionStateContainer.cs
- InstanceCollisionException.cs
- CodeComment.cs
- ModulesEntry.cs
- CodeMethodInvokeExpression.cs
- ToolStripOverflowButton.cs
- BmpBitmapEncoder.cs
- SystemWebSectionGroup.cs
- ButtonPopupAdapter.cs
- TypedTableBase.cs
- PerspectiveCamera.cs
- LayoutEditorPart.cs
- Operand.cs
- x509store.cs
- SQLDouble.cs
- CaseCqlBlock.cs
- ToolTip.cs
- RightNameExpirationInfoPair.cs
- LockCookie.cs
- TreeWalkHelper.cs
- ToolboxItemAttribute.cs
- OnOperation.cs
- PageTheme.cs
- DetailsViewCommandEventArgs.cs
- XmlSchemaFacet.cs
- GroupBox.cs
- NavigationProgressEventArgs.cs
- LinqDataSource.cs