Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- XmlQueryCardinality.cs
- ForEachAction.cs
- ClientSideQueueItem.cs
- HtmlTableCell.cs
- OleStrCAMarshaler.cs
- CodeTypeMemberCollection.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- ConstrainedDataObject.cs
- Utilities.cs
- User.cs
- AutoResizedEvent.cs
- FileRegion.cs
- SynchronousChannelMergeEnumerator.cs
- DataGridItemCollection.cs
- IndexerNameAttribute.cs
- ColorAnimation.cs
- SessionIDManager.cs
- RouteValueExpressionBuilder.cs
- FormsAuthenticationConfiguration.cs
- ObjectQuery.cs
- RIPEMD160Managed.cs
- ArraySegment.cs
- PropertyTabChangedEvent.cs
- DomNameTable.cs
- SyndicationLink.cs
- ObjectListCommand.cs
- TrackingDataItem.cs
- CharConverter.cs
- TransactedBatchingElement.cs
- SecurityPolicySection.cs
- SortFieldComparer.cs
- Attributes.cs
- ButtonStandardAdapter.cs
- TypeDelegator.cs
- XmlAtomicValue.cs
- FastEncoderWindow.cs
- ObjectTag.cs
- ExpressionPrefixAttribute.cs
- WbemException.cs
- TemplateParser.cs
- RelationshipType.cs
- RegexCode.cs
- QuotedPrintableStream.cs
- TrustLevelCollection.cs
- ClientSideQueueItem.cs
- ParseElement.cs
- ResourceBinder.cs
- MeasureData.cs
- PerformanceCounterPermissionAttribute.cs
- LookupBindingPropertiesAttribute.cs
- WindowsAuthenticationModule.cs
- ZipIOCentralDirectoryFileHeader.cs
- MetaData.cs
- RegexNode.cs
- UniqueConstraint.cs
- AssemblyBuilderData.cs
- LocationSectionRecord.cs
- SqlTypesSchemaImporter.cs
- SQLRoleProvider.cs
- MethodAccessException.cs
- MenuItem.cs
- PageContentCollection.cs
- BuildProviderCollection.cs
- TypedDataSourceCodeGenerator.cs
- FunctionQuery.cs
- XslVisitor.cs
- Publisher.cs
- MessageDroppedTraceRecord.cs
- _Win32.cs
- BCryptNative.cs
- ExpressionTextBox.xaml.cs
- MessageDirection.cs
- SoapEnumAttribute.cs
- ScrollItemPatternIdentifiers.cs
- ProgressBarRenderer.cs
- UnhandledExceptionEventArgs.cs
- QilPatternVisitor.cs
- UTF8Encoding.cs
- PreservationFileReader.cs
- SrgsSubset.cs
- FormsAuthenticationUserCollection.cs
- ApplicationDirectoryMembershipCondition.cs
- ToolStripItemRenderEventArgs.cs
- Pkcs7Recipient.cs
- _HeaderInfoTable.cs
- SmtpSection.cs
- Control.cs
- LayoutInformation.cs
- PointAnimationClockResource.cs
- EntityWrapperFactory.cs
- JsonReaderDelegator.cs
- SqlNotificationEventArgs.cs
- LogicalTreeHelper.cs
- WebServiceMethodData.cs
- XmlSerializer.cs
- CertificateReferenceElement.cs
- DataGridTableCollection.cs
- Types.cs
- SimpleTextLine.cs
- DynamicHyperLink.cs