Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / ArraySubsetEnumerator.cs / 1305376 / 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
- CaretElement.cs
- ElementNotEnabledException.cs
- CompositeFontFamily.cs
- AssemblyAssociatedContentFileAttribute.cs
- SignatureSummaryDialog.cs
- QuaternionAnimation.cs
- TabItem.cs
- SqlDataSourceCustomCommandEditor.cs
- HttpCacheParams.cs
- EDesignUtil.cs
- SizeValueSerializer.cs
- PeerToPeerException.cs
- EntitySetBaseCollection.cs
- CaseInsensitiveOrdinalStringComparer.cs
- SortQuery.cs
- MouseEventArgs.cs
- PrintingPermission.cs
- MultipleViewPattern.cs
- FontInfo.cs
- UserPreferenceChangedEventArgs.cs
- BidOverLoads.cs
- XsltOutput.cs
- WindowVisualStateTracker.cs
- WrapPanel.cs
- StringBuilder.cs
- MenuScrollingVisibilityConverter.cs
- XPathNavigatorReader.cs
- ApplicationSettingsBase.cs
- StoreItemCollection.Loader.cs
- EventSetterHandlerConverter.cs
- WindowsContainer.cs
- ReflectionServiceProvider.cs
- XPathMultyIterator.cs
- FocusWithinProperty.cs
- DateTimeUtil.cs
- Point3D.cs
- Separator.cs
- XmlIgnoreAttribute.cs
- ValidationErrorEventArgs.cs
- UrlPath.cs
- SecurityUniqueId.cs
- Publisher.cs
- DiscoveryExceptionDictionary.cs
- DuplicateWaitObjectException.cs
- XmlBinaryWriterSession.cs
- CodeMethodInvokeExpression.cs
- SinglePageViewer.cs
- TagNameToTypeMapper.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- PasswordRecovery.cs
- XmlParser.cs
- CoTaskMemHandle.cs
- Int64Converter.cs
- ToolStripSplitButton.cs
- ClientRuntimeConfig.cs
- UnknownBitmapEncoder.cs
- OpenFileDialog.cs
- Decoder.cs
- RootBrowserWindowProxy.cs
- RequestContextBase.cs
- MediaScriptCommandRoutedEventArgs.cs
- ValueUtilsSmi.cs
- VectorAnimationUsingKeyFrames.cs
- XmlSchemaComplexContent.cs
- SqlTriggerContext.cs
- base64Transforms.cs
- ImageFormat.cs
- BackEase.cs
- EvidenceBase.cs
- FloatSumAggregationOperator.cs
- CommandLibraryHelper.cs
- ApplicationSettingsBase.cs
- TypeUtils.cs
- odbcmetadatacolumnnames.cs
- GeneralTransform2DTo3D.cs
- NetMsmqSecurityMode.cs
- ProxyWebPartConnectionCollection.cs
- MenuItemCollection.cs
- MatrixTransform3D.cs
- ServiceDescription.cs
- FileChangesMonitor.cs
- KeyValueInternalCollection.cs
- SimpleWorkerRequest.cs
- JsonFormatReaderGenerator.cs
- Style.cs
- AbstractSvcMapFileLoader.cs
- _TimerThread.cs
- MailHeaderInfo.cs
- SmtpLoginAuthenticationModule.cs
- Binding.cs
- FusionWrap.cs
- SqlBuilder.cs
- XmlSignificantWhitespace.cs
- ImplicitInputBrush.cs
- ImageSourceConverter.cs
- MetadataArtifactLoaderCompositeFile.cs
- WebPartEditorCancelVerb.cs
- BrowserTree.cs
- FunctionQuery.cs
- TcpChannelHelper.cs