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
- DbSourceParameterCollection.cs
- ClassicBorderDecorator.cs
- StorageAssociationSetMapping.cs
- ListBoxChrome.cs
- BinaryObjectInfo.cs
- DataSourceCacheDurationConverter.cs
- ModelVisual3D.cs
- JavascriptCallbackBehaviorAttribute.cs
- HttpException.cs
- TraceEventCache.cs
- ThicknessConverter.cs
- CheckedPointers.cs
- ProfileSettingsCollection.cs
- GeometryValueSerializer.cs
- OracleSqlParser.cs
- UIElement3D.cs
- ResXFileRef.cs
- EntryIndex.cs
- CodeTypeReference.cs
- FileDialogPermission.cs
- ScriptControlDescriptor.cs
- SqlCacheDependencyDatabase.cs
- ImpersonationContext.cs
- RegionInfo.cs
- HtmlInputImage.cs
- XMLUtil.cs
- SafeNativeMethods.cs
- ConnectionProviderAttribute.cs
- HostProtectionPermission.cs
- HybridObjectCache.cs
- StopStoryboard.cs
- ImageConverter.cs
- PLINQETWProvider.cs
- NumericPagerField.cs
- SectionXmlInfo.cs
- CompoundFileReference.cs
- PickBranch.cs
- CodeRemoveEventStatement.cs
- MD5CryptoServiceProvider.cs
- SqlRetyper.cs
- ErrorStyle.cs
- ServiceHost.cs
- Freezable.cs
- DataGridViewSelectedRowCollection.cs
- CategoryAttribute.cs
- COM2Properties.cs
- MethodCallConverter.cs
- CodeActivityMetadata.cs
- GeometryDrawing.cs
- ViewPort3D.cs
- DesignSurface.cs
- TypeResolver.cs
- ToolStripItemEventArgs.cs
- PartDesigner.cs
- TableLayoutStyleCollection.cs
- FacetValueContainer.cs
- HashAlgorithm.cs
- DbgUtil.cs
- LineMetrics.cs
- AccessDataSourceView.cs
- PropertyGrid.cs
- AsyncMethodInvoker.cs
- SoapAttributes.cs
- TableProvider.cs
- StrongNameIdentityPermission.cs
- QueryReaderSettings.cs
- WinEventTracker.cs
- EventSinkHelperWriter.cs
- CallbackValidatorAttribute.cs
- ParsedAttributeCollection.cs
- LowerCaseStringConverter.cs
- DispatcherHooks.cs
- EpmAttributeNameBuilder.cs
- PropertyGeneratedEventArgs.cs
- OrthographicCamera.cs
- ValidationError.cs
- ItemList.cs
- WsdlInspector.cs
- DeploymentSection.cs
- XmlArrayItemAttributes.cs
- SystemSounds.cs
- DoubleCollectionValueSerializer.cs
- BamlLocalizableResource.cs
- UITypeEditor.cs
- Literal.cs
- WorkflowLayouts.cs
- HelpProvider.cs
- Point3DCollectionConverter.cs
- WebPartVerbsEventArgs.cs
- ProcessingInstructionAction.cs
- Rect.cs
- SystemColors.cs
- ExpressionLexer.cs
- NonBatchDirectoryCompiler.cs
- InsufficientMemoryException.cs
- SchemaInfo.cs
- TrackingStringDictionary.cs
- HealthMonitoringSectionHelper.cs
- HttpModuleAction.cs
- SettingsProperty.cs