Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / ArraySubsetEnumerator.cs / 1305376 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProxySimple.cs
- XPathNodePointer.cs
- ContractMapping.cs
- TypeUnloadedException.cs
- PersonalizationAdministration.cs
- PublishLicense.cs
- BufferedResponseStream.cs
- SoapSchemaExporter.cs
- Fault.cs
- SqlBinder.cs
- SettingsPropertyCollection.cs
- ParagraphResult.cs
- HttpsTransportElement.cs
- GridSplitter.cs
- X509Utils.cs
- EventLogInternal.cs
- LinqDataSource.cs
- FormatterServices.cs
- ObjectContextServiceProvider.cs
- MailHeaderInfo.cs
- PreProcessor.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- RoutedEventValueSerializer.cs
- SerializationInfo.cs
- StrongNameUtility.cs
- MarshalDirectiveException.cs
- TrackingParameters.cs
- ImageClickEventArgs.cs
- PropertyToken.cs
- ReadOnlyDictionary.cs
- MembershipValidatePasswordEventArgs.cs
- ProfileGroupSettings.cs
- XmlSchemaComplexContentExtension.cs
- XmlSchemaElement.cs
- ChildDocumentBlock.cs
- AutomationProperties.cs
- TabPageDesigner.cs
- CompareValidator.cs
- TagPrefixAttribute.cs
- DeleteStoreRequest.cs
- StateManagedCollection.cs
- TrustManager.cs
- CombinedGeometry.cs
- TreeViewEvent.cs
- Compress.cs
- Rect3D.cs
- RequestCachePolicyConverter.cs
- QuadraticBezierSegment.cs
- ActivationWorker.cs
- VoiceChangeEventArgs.cs
- ControlType.cs
- LinkLabel.cs
- DrawingAttributes.cs
- NavigatingCancelEventArgs.cs
- dbenumerator.cs
- BmpBitmapEncoder.cs
- AddingNewEventArgs.cs
- WebPartConnectionsConfigureVerb.cs
- HttpValueCollection.cs
- XmlSchemaParticle.cs
- SQLInt64.cs
- Item.cs
- IODescriptionAttribute.cs
- TableRow.cs
- CapabilitiesUse.cs
- EmptyQuery.cs
- AssemblyUtil.cs
- SortDescriptionCollection.cs
- CommonDialog.cs
- TargetControlTypeAttribute.cs
- MemberCollection.cs
- ToolZone.cs
- XmlQualifiedNameTest.cs
- SimpleType.cs
- DataGridViewHitTestInfo.cs
- GridViewColumnHeader.cs
- UInt64Storage.cs
- IsolatedStoragePermission.cs
- Size.cs
- Point3DConverter.cs
- SiteMapProvider.cs
- CapabilitiesRule.cs
- DataErrorValidationRule.cs
- TableLayoutRowStyleCollection.cs
- PassportAuthenticationEventArgs.cs
- ThreadExceptionDialog.cs
- ExcCanonicalXml.cs
- TerminateDesigner.cs
- MergablePropertyAttribute.cs
- HttpModuleActionCollection.cs
- TriState.cs
- HierarchicalDataSourceControl.cs
- FormViewDeleteEventArgs.cs
- TransportConfigurationTypeElement.cs
- ColumnReorderedEventArgs.cs
- TextTreeRootNode.cs
- AttributeUsageAttribute.cs
- QilList.cs
- Panel.cs
- DynamicPropertyReader.cs