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
- UpWmlPageAdapter.cs
- SqlTrackingService.cs
- Missing.cs
- TemplatedMailWebEventProvider.cs
- TriggerBase.cs
- ContentTypeSettingDispatchMessageFormatter.cs
- RectangleHotSpot.cs
- PenContexts.cs
- DataGridTableCollection.cs
- QueryBranchOp.cs
- XmlDataProvider.cs
- SqlClientMetaDataCollectionNames.cs
- XmlNodeList.cs
- StringSource.cs
- List.cs
- NameTable.cs
- EventLogger.cs
- TypeConvertions.cs
- ZipIORawDataFileBlock.cs
- DuplicateWaitObjectException.cs
- OdbcCommandBuilder.cs
- FileFormatException.cs
- Win32PrintDialog.cs
- Thumb.cs
- PackagingUtilities.cs
- EndPoint.cs
- APCustomTypeDescriptor.cs
- SystemThemeKey.cs
- WSFederationHttpBindingElement.cs
- ColumnResizeUndoUnit.cs
- RtfFormatStack.cs
- UnknownWrapper.cs
- DbConnectionInternal.cs
- MemberRelationshipService.cs
- GenericRootAutomationPeer.cs
- SafeWaitHandle.cs
- EncodingNLS.cs
- WebPartTracker.cs
- PageEventArgs.cs
- WindowsFormsSectionHandler.cs
- WriteableOnDemandPackagePart.cs
- TextEditorContextMenu.cs
- SqlGatherConsumedAliases.cs
- DynamicPropertyReader.cs
- EventDescriptorCollection.cs
- WebReference.cs
- XmlParserContext.cs
- ProxyGenerationError.cs
- SchemaName.cs
- IsolatedStorageException.cs
- ListBindingHelper.cs
- dataSvcMapFileLoader.cs
- InvokeBinder.cs
- ClientCultureInfo.cs
- CollectionViewSource.cs
- TextRenderer.cs
- CreateUserErrorEventArgs.cs
- WindowsEditBoxRange.cs
- CustomCategoryAttribute.cs
- InstanceDataCollection.cs
- TreeNodeSelectionProcessor.cs
- WebBrowserNavigatedEventHandler.cs
- ProfileEventArgs.cs
- _LazyAsyncResult.cs
- ColorContextHelper.cs
- DashStyle.cs
- EventManager.cs
- SqlConnection.cs
- Permission.cs
- RoutedEventArgs.cs
- TreeViewCancelEvent.cs
- Utils.cs
- SafeProcessHandle.cs
- WebPageTraceListener.cs
- RequestUriProcessor.cs
- Util.cs
- AttachmentService.cs
- SafeEventLogWriteHandle.cs
- FilterException.cs
- ParameterModifier.cs
- HttpConfigurationContext.cs
- TriggerBase.cs
- SmiEventSink.cs
- _BaseOverlappedAsyncResult.cs
- SqlUDTStorage.cs
- DeclarativeExpressionConditionDeclaration.cs
- TextRenderer.cs
- RouteUrlExpressionBuilder.cs
- PolicyValidationException.cs
- WriteTimeStream.cs
- EntityDataSourceDesigner.cs
- XamlReaderHelper.cs
- XmlName.cs
- XamlPointCollectionSerializer.cs
- PropertyExpression.cs
- InputBinding.cs
- XmlBaseWriter.cs
- FlagPanel.cs
- BufferedOutputAsyncStream.cs
- CorrelationTokenTypeConvertor.cs