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
- CriticalExceptions.cs
- ImageListStreamer.cs
- PermissionListSet.cs
- ActivityCodeDomSerializationManager.cs
- SqlRetyper.cs
- ArgumentNullException.cs
- TypeBuilder.cs
- Inline.cs
- ZipArchive.cs
- RoleManagerEventArgs.cs
- XmlnsCache.cs
- CancellationHandlerDesigner.cs
- MediaTimeline.cs
- TrustLevelCollection.cs
- EdmMember.cs
- EqualityComparer.cs
- TCEAdapterGenerator.cs
- TrackingSection.cs
- InputLanguageManager.cs
- TrackingMemoryStream.cs
- EntryPointNotFoundException.cs
- Internal.cs
- SecurityKeyIdentifier.cs
- HttpCacheVary.cs
- RecognizerStateChangedEventArgs.cs
- PhoneCallDesigner.cs
- ComboBox.cs
- DefaultValueTypeConverter.cs
- GenericEnumerator.cs
- SequenceDesigner.cs
- IMembershipProvider.cs
- EntityDataSourceContainerNameItem.cs
- NativeObjectSecurity.cs
- ProfileSettings.cs
- InputScope.cs
- HitTestDrawingContextWalker.cs
- Int32CollectionValueSerializer.cs
- Process.cs
- CoreChannel.cs
- TextSelectionHelper.cs
- TraceProvider.cs
- PathFigure.cs
- GrammarBuilderPhrase.cs
- CaseStatementSlot.cs
- AnnotationAdorner.cs
- TTSVoice.cs
- InternalBase.cs
- EllipseGeometry.cs
- ItemsControlAutomationPeer.cs
- StorageMappingItemCollection.cs
- TileBrush.cs
- TargetParameterCountException.cs
- SystemIcmpV4Statistics.cs
- CodeCommentStatementCollection.cs
- DockProviderWrapper.cs
- invalidudtexception.cs
- CheckBoxPopupAdapter.cs
- webbrowsersite.cs
- XmlSchemaSubstitutionGroup.cs
- BitmapEditor.cs
- precedingquery.cs
- ContentDisposition.cs
- StaticContext.cs
- CalloutQueueItem.cs
- ActivityExecutor.cs
- AuthenticationException.cs
- RuleInfoComparer.cs
- CompositeCollection.cs
- ValidatedControlConverter.cs
- Padding.cs
- ReferentialConstraint.cs
- ListViewHitTestInfo.cs
- EventMappingSettings.cs
- ProcessHostFactoryHelper.cs
- AuthenticatingEventArgs.cs
- XhtmlTextWriter.cs
- Function.cs
- FontTypeConverter.cs
- Deflater.cs
- GridViewRow.cs
- ActivitySurrogateSelector.cs
- ScriptResourceAttribute.cs
- NativeWrapper.cs
- BaseDataBoundControl.cs
- Utils.cs
- CodeExpressionCollection.cs
- TextEditorContextMenu.cs
- BitmapEffectInputConnector.cs
- BasicExpressionVisitor.cs
- ReaderWriterLock.cs
- MeshGeometry3D.cs
- ConstantCheck.cs
- StrongNameUtility.cs
- SqlGatherProducedAliases.cs
- SmiEventSink.cs
- DBBindings.cs
- WindowsFormsSynchronizationContext.cs
- TableStyle.cs
- HwndProxyElementProvider.cs
- SortKey.cs