Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ExtendedProtectionPolicyTypeConverter.cs
- InkCanvas.cs
- SymmetricSecurityProtocol.cs
- PropertyToken.cs
- DisableDpiAwarenessAttribute.cs
- SelectionItemPattern.cs
- dbdatarecord.cs
- WorkflowTransactionService.cs
- ExpressionNormalizer.cs
- BamlLocalizableResourceKey.cs
- WebBrowserDocumentCompletedEventHandler.cs
- HandleCollector.cs
- InvalidComObjectException.cs
- PeerNearMe.cs
- CellParaClient.cs
- ComponentConverter.cs
- CancellationTokenRegistration.cs
- DetailsViewModeEventArgs.cs
- TableLayoutSettings.cs
- WebCategoryAttribute.cs
- StorageBasedPackageProperties.cs
- ConstructorNeedsTagAttribute.cs
- FixedDocumentSequencePaginator.cs
- TypeHelpers.cs
- BaseProcessProtocolHandler.cs
- ProvideValueServiceProvider.cs
- TextViewElement.cs
- Command.cs
- MsmqIntegrationChannelFactory.cs
- ConfigurationElementProperty.cs
- SubpageParagraph.cs
- RegexStringValidatorAttribute.cs
- DataSysAttribute.cs
- XhtmlBasicObjectListAdapter.cs
- TraceListener.cs
- IsolatedStorageException.cs
- ClientScriptManagerWrapper.cs
- ContextMenu.cs
- CodeSnippetExpression.cs
- CollectionDataContractAttribute.cs
- SmtpSection.cs
- XhtmlBasicValidationSummaryAdapter.cs
- UserControlDocumentDesigner.cs
- KeySpline.cs
- loginstatus.cs
- Hex.cs
- Merger.cs
- SpecularMaterial.cs
- fixedPageContentExtractor.cs
- AdornedElementPlaceholder.cs
- BamlRecords.cs
- NamedPipeProcessProtocolHandler.cs
- PenThreadWorker.cs
- TemplateParser.cs
- MethodRental.cs
- ImageAttributes.cs
- ImportRequest.cs
- LinqDataSourceHelper.cs
- CommunicationObjectManager.cs
- HostingPreferredMapPath.cs
- FunctionNode.cs
- DataGridViewColumnCollectionDialog.cs
- BookmarkTable.cs
- Base64Encoder.cs
- FilteredAttributeCollection.cs
- TrackingProfileDeserializationException.cs
- CallSite.cs
- DesignerSerializationVisibilityAttribute.cs
- GiveFeedbackEvent.cs
- CounterCreationData.cs
- NumericUpDown.cs
- DecoderNLS.cs
- Point3DIndependentAnimationStorage.cs
- WindowsRichEditRange.cs
- ValidationRuleCollection.cs
- TimeEnumHelper.cs
- ClientRuntimeConfig.cs
- StrokeNodeData.cs
- Point3DAnimation.cs
- ManipulationDevice.cs
- NullRuntimeConfig.cs
- IntranetCredentialPolicy.cs
- UserControl.cs
- PointAnimationUsingKeyFrames.cs
- DateTimeConverter2.cs
- Variable.cs
- XmlTextReader.cs
- SystemGatewayIPAddressInformation.cs
- LinkClickEvent.cs
- TableCellCollection.cs
- KnownTypesProvider.cs
- DrawListViewSubItemEventArgs.cs
- SkewTransform.cs
- UnSafeCharBuffer.cs
- OdbcDataReader.cs
- StickyNote.cs
- MemoryMappedFileSecurity.cs
- BuildProvidersCompiler.cs
- WebPartChrome.cs
- EntityDataSourceColumn.cs