Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LocalServiceSecuritySettingsElement.cs
- TypeConstant.cs
- ClientWindowsAuthenticationMembershipProvider.cs
- ObjectQueryProvider.cs
- Delay.cs
- Component.cs
- COM2PropertyDescriptor.cs
- TaskExceptionHolder.cs
- FlowDocument.cs
- MimeReturn.cs
- Rectangle.cs
- CookielessData.cs
- ResourcePermissionBaseEntry.cs
- TrustLevel.cs
- BitmapEffectOutputConnector.cs
- LazyTextWriterCreator.cs
- NodeInfo.cs
- DataGridViewHeaderCell.cs
- basevalidator.cs
- MemoryPressure.cs
- IndentedWriter.cs
- Validator.cs
- AuthenticationModuleElement.cs
- XhtmlTextWriter.cs
- UriWriter.cs
- TextServicesDisplayAttributePropertyRanges.cs
- SplashScreen.cs
- XmlAttributeCollection.cs
- SiteMapProvider.cs
- BindingValueChangedEventArgs.cs
- PeekCompletedEventArgs.cs
- MailMessageEventArgs.cs
- AnimationClock.cs
- LinkClickEvent.cs
- PropertyPathWorker.cs
- HScrollProperties.cs
- XmlReflectionImporter.cs
- DataGridViewUtilities.cs
- RegexRunnerFactory.cs
- WebPartUtil.cs
- PreProcessor.cs
- StandardCommands.cs
- ProviderBase.cs
- DataViewSetting.cs
- _HTTPDateParse.cs
- WeakReferenceKey.cs
- SchemaSetCompiler.cs
- TreeNodeCollection.cs
- TextTreeExtractElementUndoUnit.cs
- IntSecurity.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- CodeTypeDeclarationCollection.cs
- TextElement.cs
- Rotation3DKeyFrameCollection.cs
- CodeThrowExceptionStatement.cs
- TargetControlTypeAttribute.cs
- SchemaManager.cs
- IProvider.cs
- EndpointIdentityExtension.cs
- InkCanvasAutomationPeer.cs
- SchemaInfo.cs
- EventEntry.cs
- HierarchicalDataSourceConverter.cs
- SmiEventSink_Default.cs
- InlineCategoriesDocument.cs
- Material.cs
- ScriptModule.cs
- SafeEventHandle.cs
- XsdCachingReader.cs
- FileRecordSequence.cs
- BitmapEffectDrawingContent.cs
- RecordManager.cs
- AdornerDecorator.cs
- SplineKeyFrames.cs
- ZipQueryOperator.cs
- ActivityInstanceMap.cs
- TokenizerHelper.cs
- ObjectMemberMapping.cs
- wpf-etw.cs
- ThaiBuddhistCalendar.cs
- PermissionSetTriple.cs
- ProcessManager.cs
- MissingSatelliteAssemblyException.cs
- TreeNodeConverter.cs
- mda.cs
- AspNetPartialTrustHelpers.cs
- NativeObjectSecurity.cs
- WebPartHeaderCloseVerb.cs
- XmlUrlResolver.cs
- ObjectParameter.cs
- PageFunction.cs
- SystemIcmpV6Statistics.cs
- UnsafeNativeMethods.cs
- CLSCompliantAttribute.cs
- cookiecollection.cs
- ListViewUpdatedEventArgs.cs
- PointCollectionConverter.cs
- GridViewColumn.cs
- DbParameterCollection.cs
- UTF7Encoding.cs