Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WindowsFormsSectionHandler.cs
- MouseEvent.cs
- ApplicationDirectory.cs
- HotCommands.cs
- ModuleBuilderData.cs
- PolicyDesigner.cs
- CryptoApi.cs
- OdbcConnectionPoolProviderInfo.cs
- HitTestParameters3D.cs
- SqlInternalConnectionSmi.cs
- DbConnectionStringBuilder.cs
- GridView.cs
- recordstatescratchpad.cs
- _AutoWebProxyScriptWrapper.cs
- ValidationErrorCollection.cs
- PerformanceCounters.cs
- filewebresponse.cs
- PolicyValidationException.cs
- GlyphRunDrawing.cs
- RuntimeEnvironment.cs
- oledbmetadatacolumnnames.cs
- WebColorConverter.cs
- ObjectQueryState.cs
- MetadataUtil.cs
- OleDbException.cs
- OleDbMetaDataFactory.cs
- HttpFileCollection.cs
- ScriptIgnoreAttribute.cs
- WebPartPersonalization.cs
- DispatcherHooks.cs
- ActivityDesigner.cs
- UpdateManifestForBrowserApplication.cs
- _AuthenticationState.cs
- XmlEntityReference.cs
- ColorMatrix.cs
- DesignerCatalogPartChrome.cs
- XmlSerializerImportOptions.cs
- _OSSOCK.cs
- State.cs
- ProxyGenerator.cs
- JournalEntry.cs
- SamlAssertionKeyIdentifierClause.cs
- Brushes.cs
- Int32CAMarshaler.cs
- TypeNameHelper.cs
- ConstraintCollection.cs
- TraceUtility.cs
- CharacterMetrics.cs
- BoundColumn.cs
- WebPartEditorOkVerb.cs
- SelectionHighlightInfo.cs
- ConfigurationValidatorBase.cs
- InternalConfigEventArgs.cs
- MarginCollapsingState.cs
- LogLogRecordHeader.cs
- DateTimeFormatInfoScanner.cs
- CursorConverter.cs
- DiscoveryInnerClientAdhoc11.cs
- DesignerOptionService.cs
- DatatypeImplementation.cs
- DesignColumn.cs
- XmlSchemaAttributeGroup.cs
- Animatable.cs
- XmlSerializerAssemblyAttribute.cs
- XmlReflectionImporter.cs
- XPathQilFactory.cs
- HandlerBase.cs
- MatrixCamera.cs
- SmtpClient.cs
- ColorBlend.cs
- CertificateReferenceElement.cs
- CatalogPartChrome.cs
- SqlDataAdapter.cs
- QueryCacheManager.cs
- XMLDiffLoader.cs
- OutKeywords.cs
- TemplateBindingExtensionConverter.cs
- XmlUtil.cs
- DesignBinding.cs
- ConstraintManager.cs
- EncodingTable.cs
- SubMenuStyle.cs
- CreatingCookieEventArgs.cs
- DbUpdateCommandTree.cs
- GridViewRowPresenterBase.cs
- ProviderIncompatibleException.cs
- TdsRecordBufferSetter.cs
- DesignerDataTableBase.cs
- EncodingDataItem.cs
- ErrorTableItemStyle.cs
- CompositeDataBoundControl.cs
- PropertyGridView.cs
- BufferedStream.cs
- ObjRef.cs
- InvalidateEvent.cs
- DesigntimeLicenseContextSerializer.cs
- XsltQilFactory.cs
- RuleRef.cs
- SQLCharsStorage.cs
- XslException.cs