Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- BufferedOutputStream.cs
- EventLogHandle.cs
- QuerySubExprEliminator.cs
- PackageRelationshipSelector.cs
- WorkItem.cs
- EncodingTable.cs
- DataContractSerializerServiceBehavior.cs
- HttpListenerResponse.cs
- ContentIterators.cs
- IntegerFacetDescriptionElement.cs
- NegationPusher.cs
- LastQueryOperator.cs
- WSSecurityJan2004.cs
- OutputScope.cs
- DaylightTime.cs
- Bidi.cs
- SRDisplayNameAttribute.cs
- InternalRelationshipCollection.cs
- ListView.cs
- NativeMethods.cs
- ACE.cs
- HtmlTableRowCollection.cs
- TextBoxAutoCompleteSourceConverter.cs
- CreateDataSourceDialog.cs
- InstanceBehavior.cs
- PolyLineSegmentFigureLogic.cs
- ISFClipboardData.cs
- DataGridViewRowConverter.cs
- QueryAccessibilityHelpEvent.cs
- TextPointerBase.cs
- RpcCryptoRequest.cs
- coordinatorscratchpad.cs
- TableItemStyle.cs
- CalendarTable.cs
- RevocationPoint.cs
- BlurBitmapEffect.cs
- ResolveDuplex11AsyncResult.cs
- MobileTemplatedControlDesigner.cs
- PropertyEntry.cs
- GenericAuthenticationEventArgs.cs
- Selection.cs
- XmlSchemaAttributeGroup.cs
- Rss20FeedFormatter.cs
- _OverlappedAsyncResult.cs
- ArgumentFixer.cs
- DataGridViewLinkColumn.cs
- MatrixConverter.cs
- DataDocumentXPathNavigator.cs
- MDIWindowDialog.cs
- QueryStoreStatusRequest.cs
- RectangleGeometry.cs
- XpsPartBase.cs
- _Semaphore.cs
- DetailsViewUpdateEventArgs.cs
- DataTableTypeConverter.cs
- CodeGenerator.cs
- Matrix3D.cs
- XmlExtensionFunction.cs
- SecurityHelper.cs
- SharedPersonalizationStateInfo.cs
- AllMembershipCondition.cs
- RegexParser.cs
- Event.cs
- UndoManager.cs
- SqlUDTStorage.cs
- ViewStateModeByIdAttribute.cs
- XpsS0ValidatingLoader.cs
- InlineObject.cs
- MenuItemBinding.cs
- RsaSecurityTokenParameters.cs
- NotifyCollectionChangedEventArgs.cs
- IdentifierCollection.cs
- BindToObject.cs
- CryptoApi.cs
- IndicShape.cs
- AttributeUsageAttribute.cs
- SessionStateModule.cs
- XmlSchemaComplexType.cs
- SafeNativeMethodsOther.cs
- RegexWriter.cs
- CultureMapper.cs
- HostingEnvironmentException.cs
- UnauthorizedWebPart.cs
- DependentTransaction.cs
- TextTreeDeleteContentUndoUnit.cs
- Visitors.cs
- HtmlEncodedRawTextWriter.cs
- RegexCode.cs
- LinearGradientBrush.cs
- Header.cs
- PartitionerStatic.cs
- XmlSchemaImporter.cs
- BypassElement.cs
- DataContractAttribute.cs
- EdmToObjectNamespaceMap.cs
- SmtpCommands.cs
- httpserverutility.cs
- HtmlForm.cs
- DataTableClearEvent.cs
- EUCJPEncoding.cs