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
- DataGridViewCellStyleEditor.cs
- ReadOnlyKeyedCollection.cs
- QilDataSource.cs
- Stroke2.cs
- SecurityRuntime.cs
- CodeTypeMember.cs
- XamlWriter.cs
- FontCollection.cs
- ManifestResourceInfo.cs
- PointConverter.cs
- DataGridViewUtilities.cs
- DataSourceDescriptorCollection.cs
- RequiredArgumentAttribute.cs
- StandardTransformFactory.cs
- WindowsTokenRoleProvider.cs
- SerialErrors.cs
- XmlNodeReader.cs
- FixedSOMTableRow.cs
- RegionInfo.cs
- Argument.cs
- ToolboxDataAttribute.cs
- DeclarativeCatalogPart.cs
- DiscoveryDocumentLinksPattern.cs
- EventLog.cs
- SelectionEditor.cs
- AsymmetricAlgorithm.cs
- ToolBarButton.cs
- PointLightBase.cs
- TabItemAutomationPeer.cs
- safemediahandle.cs
- OledbConnectionStringbuilder.cs
- AuthenticateEventArgs.cs
- GridViewPageEventArgs.cs
- ReferencedAssemblyResolver.cs
- validationstate.cs
- CodeSubDirectory.cs
- PassportAuthentication.cs
- _NtlmClient.cs
- HatchBrush.cs
- IdleTimeoutMonitor.cs
- WebScriptMetadataMessageEncoderFactory.cs
- grammarelement.cs
- X509WindowsSecurityToken.cs
- EmissiveMaterial.cs
- SolidBrush.cs
- FtpCachePolicyElement.cs
- COSERVERINFO.cs
- XmlSignificantWhitespace.cs
- MessageFilterException.cs
- ServiceAppDomainAssociationProvider.cs
- HandleRef.cs
- Matrix3DConverter.cs
- DynamicUpdateCommand.cs
- DataSourceXmlSubItemAttribute.cs
- ResourceKey.cs
- DataGridCaption.cs
- ServiceOperation.cs
- AuthenticationService.cs
- XAMLParseException.cs
- UnionCodeGroup.cs
- SecurityUtils.cs
- ForeignKeyConstraint.cs
- WebGetAttribute.cs
- HttpCacheParams.cs
- AttributeAction.cs
- Dump.cs
- ipaddressinformationcollection.cs
- WebPartDescription.cs
- MsmqIntegrationSecurityMode.cs
- OneOfScalarConst.cs
- querybuilder.cs
- TextViewBase.cs
- MonthChangedEventArgs.cs
- SequentialWorkflowHeaderFooter.cs
- ServiceOperationHelpers.cs
- NonVisualControlAttribute.cs
- ColumnCollection.cs
- ActivationServices.cs
- ServiceHostingEnvironmentSection.cs
- PeerPresenceInfo.cs
- ViewStateAttachedPropertyFeature.cs
- ControlPersister.cs
- SqlIdentifier.cs
- VectorCollection.cs
- HtmlToClrEventProxy.cs
- DrawingGroup.cs
- Win32.cs
- GenericXmlSecurityToken.cs
- SetStoryboardSpeedRatio.cs
- CommonRemoteMemoryBlock.cs
- EdmToObjectNamespaceMap.cs
- Label.cs
- Button.cs
- BulletDecorator.cs
- ObjectListFieldCollection.cs
- CatalogZoneAutoFormat.cs
- FlowDocument.cs
- BindingBase.cs
- StyleModeStack.cs
- AssemblySettingAttributes.cs