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
- DataServiceException.cs
- ErrorHandler.cs
- HierarchicalDataSourceControl.cs
- CustomValidator.cs
- GatewayIPAddressInformationCollection.cs
- DependencyProperty.cs
- IdentityNotMappedException.cs
- StreamWithDictionary.cs
- XmlSchemaInfo.cs
- StrongNamePublicKeyBlob.cs
- CommandValueSerializer.cs
- documentation.cs
- FixedTextBuilder.cs
- DoubleSumAggregationOperator.cs
- Codec.cs
- ViewManagerAttribute.cs
- MobileControlsSectionHandler.cs
- ItemCheckEvent.cs
- SystemNetworkInterface.cs
- DesignerView.xaml.cs
- AssociationTypeEmitter.cs
- StreamUpdate.cs
- CodeNamespaceImportCollection.cs
- CancellationTokenRegistration.cs
- SoapExtensionTypeElement.cs
- NativeRightsManagementAPIsStructures.cs
- EventWaitHandleSecurity.cs
- DBSchemaRow.cs
- PointConverter.cs
- RightsManagementPermission.cs
- SqlProviderServices.cs
- SqlUtil.cs
- DataSourceCacheDurationConverter.cs
- ExclusiveHandleList.cs
- SessionPageStateSection.cs
- EventLogPermissionEntry.cs
- ConnectionsZoneDesigner.cs
- mediapermission.cs
- BufferedReceiveElement.cs
- UserInitiatedRoutedEventPermission.cs
- Size.cs
- SettingsBase.cs
- RNGCryptoServiceProvider.cs
- ListControlStringCollectionEditor.cs
- SubqueryRules.cs
- DelegatingTypeDescriptionProvider.cs
- ExpressionParser.cs
- PieceNameHelper.cs
- WebServiceEnumData.cs
- ConstantSlot.cs
- DataServiceException.cs
- OracleFactory.cs
- InstanceHandleReference.cs
- CollectionChange.cs
- Mapping.cs
- XmlSchemaAppInfo.cs
- DataTableNewRowEvent.cs
- ViewStateException.cs
- DbModificationCommandTree.cs
- WebRequestModulesSection.cs
- StylusTip.cs
- SQLSingle.cs
- Schema.cs
- PeerPresenceInfo.cs
- HtmlControlDesigner.cs
- SmiRequestExecutor.cs
- DataGridViewIntLinkedList.cs
- mansign.cs
- BindableTemplateBuilder.cs
- TabletDeviceInfo.cs
- HostAdapter.cs
- SqlHelper.cs
- CLSCompliantAttribute.cs
- HtmlInputButton.cs
- SafePointer.cs
- ComponentDispatcherThread.cs
- ScriptControl.cs
- DataKeyCollection.cs
- BaseProcessor.cs
- DocumentPage.cs
- EventProviderClassic.cs
- MessageSmuggler.cs
- BinaryExpression.cs
- HtmlMeta.cs
- TargetConverter.cs
- SecurityDescriptor.cs
- DataGridSortCommandEventArgs.cs
- PropertyMetadata.cs
- HMACSHA512.cs
- DataServiceRequest.cs
- BigInt.cs
- SamlSubjectStatement.cs
- ResourceProviderFactory.cs
- MiniAssembly.cs
- DbParameterHelper.cs
- ConfigurationValidatorBase.cs
- BookmarkEventArgs.cs
- TabItemAutomationPeer.cs
- GetLedgerEntryForRecipientRequest.cs
- IPHostEntry.cs