Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- SizeChangedInfo.cs
- EmptyControlCollection.cs
- ClientRoleProvider.cs
- ExpanderAutomationPeer.cs
- TextTreeTextElementNode.cs
- HtmlInputCheckBox.cs
- DbDataReader.cs
- TransactionChannelListener.cs
- GZipStream.cs
- JsonDeserializer.cs
- IssuanceTokenProviderBase.cs
- Range.cs
- StorageTypeMapping.cs
- NavigationProperty.cs
- ExtenderProvidedPropertyAttribute.cs
- MobileControlsSection.cs
- DoubleAnimationClockResource.cs
- XmlReaderDelegator.cs
- SmiConnection.cs
- TemplateField.cs
- AuthorizationRule.cs
- RegionData.cs
- SystemTcpConnection.cs
- Schema.cs
- COM2ColorConverter.cs
- ProcessHostConfigUtils.cs
- IndexedString.cs
- QuaternionConverter.cs
- VisualStyleInformation.cs
- JapaneseCalendar.cs
- InfoCardService.cs
- SendSecurityHeaderElement.cs
- TemplateColumn.cs
- ProfilePropertyNameValidator.cs
- MulticastIPAddressInformationCollection.cs
- InvalidDataException.cs
- ProtocolReflector.cs
- PerformanceCounters.cs
- BevelBitmapEffect.cs
- updatecommandorderer.cs
- StringInfo.cs
- PackUriHelper.cs
- WebBrowserSiteBase.cs
- AppliedDeviceFiltersEditor.cs
- ArraySegment.cs
- CryptoConfig.cs
- MergeLocalizationDirectives.cs
- shaperfactoryquerycachekey.cs
- DoubleCollectionConverter.cs
- DllNotFoundException.cs
- SimpleTextLine.cs
- WebPageTraceListener.cs
- DataServiceResponse.cs
- CurrentTimeZone.cs
- IdentityVerifier.cs
- WebServiceTypeData.cs
- ConfigurationProperty.cs
- _CookieModule.cs
- ConfigurationSectionCollection.cs
- ReservationCollection.cs
- TextSimpleMarkerProperties.cs
- FontStyles.cs
- RsaSecurityToken.cs
- OleDbReferenceCollection.cs
- EdmFunction.cs
- WebPartTransformerCollection.cs
- ConfigXmlWhitespace.cs
- HttpDictionary.cs
- HtmlFormParameterWriter.cs
- AttachmentService.cs
- LOSFormatter.cs
- ChooseAction.cs
- CustomValidator.cs
- ListBindingConverter.cs
- FileIOPermission.cs
- WhitespaceRuleLookup.cs
- AnnotationService.cs
- ImportCatalogPart.cs
- KeyTime.cs
- SignatureConfirmations.cs
- WhitespaceRuleReader.cs
- DataBoundLiteralControl.cs
- RightsManagementEncryptedStream.cs
- DesignerTextBoxAdapter.cs
- InstalledFontCollection.cs
- MergeLocalizationDirectives.cs
- UnmanagedMemoryStreamWrapper.cs
- WebControlAdapter.cs
- ContainerSelectorBehavior.cs
- Codec.cs
- FileDialog.cs
- WebPartTransformerAttribute.cs
- SqlProcedureAttribute.cs
- ReflectPropertyDescriptor.cs
- ValidationRuleCollection.cs
- CommandBinding.cs
- ControlBindingsCollection.cs
- BaseResourcesBuildProvider.cs
- StylusEventArgs.cs
- Stackframe.cs