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
- GlyphTypeface.cs
- EdmComplexPropertyAttribute.cs
- SortedList.cs
- SafeProcessHandle.cs
- Stroke2.cs
- TemplateXamlParser.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- ShapingWorkspace.cs
- XpsS0ValidatingLoader.cs
- TdsRecordBufferSetter.cs
- QueryFunctions.cs
- EncoderParameters.cs
- newinstructionaction.cs
- GenericEnumerator.cs
- SoapAttributeOverrides.cs
- ResXResourceReader.cs
- ExpressionEditorAttribute.cs
- IdentityHolder.cs
- LocalizableAttribute.cs
- ListViewCancelEventArgs.cs
- RbTree.cs
- XmlDataSourceView.cs
- UnmanagedMemoryStream.cs
- AtomicFile.cs
- BreakRecordTable.cs
- PartialCachingAttribute.cs
- _Win32.cs
- IItemProperties.cs
- WebPartManager.cs
- RemoteWebConfigurationHost.cs
- Aggregates.cs
- dataobject.cs
- PropertyInfoSet.cs
- SchemaMapping.cs
- DrawingAttributes.cs
- GACIdentityPermission.cs
- ConfigXmlText.cs
- HistoryEventArgs.cs
- XmlSchemaProviderAttribute.cs
- DispatcherEventArgs.cs
- KeyFrames.cs
- AssemblyInfo.cs
- BamlLocalizabilityResolver.cs
- ManagedWndProcTracker.cs
- ElementAtQueryOperator.cs
- CustomValidator.cs
- XpsFilter.cs
- HttpCacheParams.cs
- NetworkInformationException.cs
- RIPEMD160Managed.cs
- XmlCodeExporter.cs
- PackageRelationship.cs
- safex509handles.cs
- TextRangeEditLists.cs
- CommandSet.cs
- Point3DCollectionValueSerializer.cs
- X509CertificateClaimSet.cs
- StateBag.cs
- NamedPipeConnectionPool.cs
- ByteStack.cs
- WebFormDesignerActionService.cs
- XsdBuilder.cs
- ArrayTypeMismatchException.cs
- FileNotFoundException.cs
- SqlDataRecord.cs
- ChangeBlockUndoRecord.cs
- Help.cs
- ThicknessKeyFrameCollection.cs
- DesignRelation.cs
- WindowExtensionMethods.cs
- FeatureSupport.cs
- mediaeventshelper.cs
- SqlDataSource.cs
- SafeMILHandle.cs
- _TransmitFileOverlappedAsyncResult.cs
- SectionRecord.cs
- QilGenerator.cs
- XmlSerializerVersionAttribute.cs
- SocketInformation.cs
- XamlContextStack.cs
- Accessible.cs
- UnorderedHashRepartitionStream.cs
- DynamicMethod.cs
- AppDomainFactory.cs
- OutputCacheSettings.cs
- WebPartConnectionsCancelVerb.cs
- SubqueryRules.cs
- TCPListener.cs
- HitTestWithGeometryDrawingContextWalker.cs
- CookielessHelper.cs
- NetStream.cs
- MultiSelector.cs
- SplitterCancelEvent.cs
- SamlSubject.cs
- IdnElement.cs
- __Filters.cs
- CompiledQuery.cs
- EventLog.cs
- ProcessManager.cs
- RequestCacheEntry.cs