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
- ControlBindingsCollection.cs
- XmlSchemaAppInfo.cs
- Rect.cs
- PrintPreviewGraphics.cs
- WebPartConnection.cs
- AnimationClock.cs
- PhysicalFontFamily.cs
- SamlNameIdentifierClaimResource.cs
- WorkflowControlClient.cs
- ByteAnimation.cs
- OracleConnectionFactory.cs
- TraceListener.cs
- ConnectionPool.cs
- ComponentManagerBroker.cs
- ACL.cs
- Tuple.cs
- CachedRequestParams.cs
- SafeMemoryMappedFileHandle.cs
- WmlCommandAdapter.cs
- JoinSymbol.cs
- HtmlTableRowCollection.cs
- TextContainerHelper.cs
- WizardStepBase.cs
- WebExceptionStatus.cs
- ValidationSummary.cs
- EmptyEnumerator.cs
- CommandField.cs
- SqlDataSourceQueryConverter.cs
- EditBehavior.cs
- QilGeneratorEnv.cs
- ResponseBodyWriter.cs
- StateMachineWorkflowInstance.cs
- StrokeCollection2.cs
- GraphicsPath.cs
- MethodBody.cs
- NavigationHelper.cs
- WebSysDisplayNameAttribute.cs
- WpfXamlType.cs
- PersonalizationAdministration.cs
- CallTemplateAction.cs
- SecurityAppliedMessage.cs
- XmlSchemaAnyAttribute.cs
- NullableDoubleAverageAggregationOperator.cs
- XmlFormatReaderGenerator.cs
- _emptywebproxy.cs
- ShapingWorkspace.cs
- ImageAttributes.cs
- WebBrowsableAttribute.cs
- XmlSequenceWriter.cs
- _CookieModule.cs
- EmptyCollection.cs
- EventToken.cs
- PngBitmapEncoder.cs
- ScrollChrome.cs
- PhysicalAddress.cs
- XmlSchemaComplexContentRestriction.cs
- SafeFreeMibTable.cs
- DataGridTablesFactory.cs
- DecimalConverter.cs
- RegexWriter.cs
- AllowedAudienceUriElementCollection.cs
- DataSourceCacheDurationConverter.cs
- VisualTreeFlattener.cs
- ZipIOCentralDirectoryBlock.cs
- CookielessHelper.cs
- Scene3D.cs
- GeometryDrawing.cs
- AddInServer.cs
- CodePageUtils.cs
- EnterpriseServicesHelper.cs
- StreamAsIStream.cs
- LongMinMaxAggregationOperator.cs
- WebBrowserProgressChangedEventHandler.cs
- COM2ICategorizePropertiesHandler.cs
- XmlSchemaCompilationSettings.cs
- SqlConnectionString.cs
- ResourceAssociationSet.cs
- InstanceData.cs
- StringUtil.cs
- Sql8ExpressionRewriter.cs
- RuleSettingsCollection.cs
- IISUnsafeMethods.cs
- StructuredCompositeActivityDesigner.cs
- SystemDiagnosticsSection.cs
- HashAlgorithm.cs
- LookupBindingPropertiesAttribute.cs
- TargetConverter.cs
- ComponentTray.cs
- QilLiteral.cs
- SerializationObjectManager.cs
- DataGridBeginningEditEventArgs.cs
- XNameConverter.cs
- DataGridCell.cs
- UInt32.cs
- CoTaskMemHandle.cs
- PriorityQueue.cs
- PrimitiveCodeDomSerializer.cs
- CustomDictionarySources.cs
- WorkflowHostingResponseContext.cs
- ExtractCollection.cs