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
- MatrixConverter.cs
- SqlLiftIndependentRowExpressions.cs
- Rotation3D.cs
- TextServicesLoader.cs
- DataGridCellsPanel.cs
- SaveFileDialog.cs
- BitmapEffectDrawingContextWalker.cs
- externdll.cs
- ConfigurationStrings.cs
- UpDownEvent.cs
- RootBuilder.cs
- FreeFormDragDropManager.cs
- TextRangeEditLists.cs
- InvalidateEvent.cs
- RestClientProxyHandler.cs
- IsolatedStorageFilePermission.cs
- Rules.cs
- BufferedGraphicsManager.cs
- ErrorWebPart.cs
- CounterSample.cs
- Binding.cs
- ArrangedElement.cs
- PictureBox.cs
- DashStyle.cs
- ImageUrlEditor.cs
- DataGridViewCellStateChangedEventArgs.cs
- CompilationUtil.cs
- BasicCellRelation.cs
- SecurityMode.cs
- LinqDataSourceUpdateEventArgs.cs
- GridViewCellAutomationPeer.cs
- wmiutil.cs
- GrabHandleGlyph.cs
- PartialClassGenerationTask.cs
- _LocalDataStoreMgr.cs
- DataShape.cs
- Size3DConverter.cs
- TypeValidationEventArgs.cs
- WebPartZoneAutoFormat.cs
- CompositeActivityTypeDescriptorProvider.cs
- DataBoundControlAdapter.cs
- DataKey.cs
- Bits.cs
- XamlPoint3DCollectionSerializer.cs
- XmlEntityReference.cs
- MatrixUtil.cs
- BadImageFormatException.cs
- HostingEnvironmentSection.cs
- FlowDocumentView.cs
- DecodeHelper.cs
- ProtocolException.cs
- HtmlTable.cs
- Line.cs
- SerializerDescriptor.cs
- FlowLayoutPanel.cs
- GB18030Encoding.cs
- SqlDataSource.cs
- GroupBoxRenderer.cs
- StrongNameKeyPair.cs
- CancellationToken.cs
- DrawingBrush.cs
- HtmlEmptyTagControlBuilder.cs
- AnimationClock.cs
- EqualityComparer.cs
- XPathDocumentIterator.cs
- TraceUtility.cs
- Wrapper.cs
- EventListener.cs
- PropertyIdentifier.cs
- FontFamily.cs
- Enum.cs
- RegexMatchCollection.cs
- FontStretch.cs
- ArrayListCollectionBase.cs
- ResourceExpression.cs
- CalendarItem.cs
- TraceData.cs
- InvalidCastException.cs
- HttpHandlersSection.cs
- AsnEncodedData.cs
- FixedPosition.cs
- ChildrenQuery.cs
- PropertyExpression.cs
- PermissionListSet.cs
- DiagnosticsElement.cs
- SAPIEngineTypes.cs
- URI.cs
- SmtpNetworkElement.cs
- SudsWriter.cs
- TabItemWrapperAutomationPeer.cs
- ExpanderAutomationPeer.cs
- ZoneLinkButton.cs
- LoadRetryStrategyFactory.cs
- Int64AnimationUsingKeyFrames.cs
- CodeAttributeDeclaration.cs
- InvokePattern.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- ResourcePool.cs
- TypeDelegator.cs
- MobileListItem.cs