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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Mappings.cs
- Socket.cs
- FileDialogCustomPlace.cs
- HandlerBase.cs
- UnicodeEncoding.cs
- IIS7UserPrincipal.cs
- MenuItemStyle.cs
- LocatorPart.cs
- ReferentialConstraint.cs
- Header.cs
- TableLayoutColumnStyleCollection.cs
- SyndicationFeed.cs
- Matrix3DStack.cs
- MulticastDelegate.cs
- MDIClient.cs
- XsltLoader.cs
- LinqDataSourceValidationException.cs
- odbcmetadatacolumnnames.cs
- CustomGrammar.cs
- CodeParameterDeclarationExpressionCollection.cs
- BooleanAnimationBase.cs
- CacheChildrenQuery.cs
- NameSpaceExtractor.cs
- ScrollChrome.cs
- XPathMultyIterator.cs
- XmlSignatureProperties.cs
- CodeIterationStatement.cs
- Transform.cs
- ColumnResizeUndoUnit.cs
- DateTimeOffset.cs
- ContextQuery.cs
- Mapping.cs
- AmbiguousMatchException.cs
- SapiRecoInterop.cs
- HttpValueCollection.cs
- ReferencedCollectionType.cs
- ToolStripMenuItem.cs
- RowToParametersTransformer.cs
- ReflectionServiceProvider.cs
- XmlRootAttribute.cs
- PromptEventArgs.cs
- HtmlInputButton.cs
- TypeLibConverter.cs
- CodeDomConfigurationHandler.cs
- ButtonBaseDesigner.cs
- SqlGenericUtil.cs
- backend.cs
- AgileSafeNativeMemoryHandle.cs
- Invariant.cs
- DeviceContext.cs
- ToolBarButtonDesigner.cs
- ConfigXmlCDataSection.cs
- ManipulationStartingEventArgs.cs
- BufferBuilder.cs
- SimpleApplicationHost.cs
- HtmlTextArea.cs
- HttpCookieCollection.cs
- CodeDelegateCreateExpression.cs
- MimeTypeMapper.cs
- TableLayoutSettings.cs
- SafeRightsManagementQueryHandle.cs
- XamlInterfaces.cs
- HttpRuntimeSection.cs
- TemplateParser.cs
- UITypeEditor.cs
- StateMachineTimers.cs
- ContentValidator.cs
- ProfilePropertySettings.cs
- CodeAttributeArgument.cs
- QuaternionRotation3D.cs
- InvalidDocumentContentsException.cs
- CleanUpVirtualizedItemEventArgs.cs
- CodeArrayCreateExpression.cs
- ScriptingSectionGroup.cs
- JavaScriptSerializer.cs
- Rotation3D.cs
- HelloOperation11AsyncResult.cs
- ProcessProtocolHandler.cs
- DataPagerFieldCollection.cs
- CodeTypeOfExpression.cs
- SystemTcpStatistics.cs
- EventListenerClientSide.cs
- VirtualDirectoryMappingCollection.cs
- OperationAbortedException.cs
- SchemaTableColumn.cs
- DataGridAddNewRow.cs
- TextTreeUndoUnit.cs
- MissingFieldException.cs
- Int32EqualityComparer.cs
- HyperLink.cs
- PageBuildProvider.cs
- ObfuscationAttribute.cs
- Rect3DConverter.cs
- X509CertificateClaimSet.cs
- SymmetricAlgorithm.cs
- EventDescriptorCollection.cs
- TextTabProperties.cs
- Publisher.cs
- CodeBlockBuilder.cs
- SapiInterop.cs