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
- HttpHandlerActionCollection.cs
- Button.cs
- EventDriven.cs
- RegexNode.cs
- EntityModelBuildProvider.cs
- SQLSingle.cs
- RtfFormatStack.cs
- Span.cs
- UnauthorizedWebPart.cs
- Nodes.cs
- XmlSchemaNotation.cs
- ContentTextAutomationPeer.cs
- DataGridRowClipboardEventArgs.cs
- InputLanguageSource.cs
- ScrollBarAutomationPeer.cs
- EntityContainer.cs
- SQLInt32Storage.cs
- DebuggerAttributes.cs
- RightsManagementUser.cs
- ConsumerConnectionPointCollection.cs
- ByteFacetDescriptionElement.cs
- COM2PictureConverter.cs
- DataGridViewColumnHeaderCell.cs
- EditorPartCollection.cs
- SmiEventSink_DeferedProcessing.cs
- IApplicationTrustManager.cs
- XsltQilFactory.cs
- DefaultValueConverter.cs
- TemplateParser.cs
- UserControlParser.cs
- AttachmentService.cs
- CellLabel.cs
- CheckBoxList.cs
- FileDialogCustomPlacesCollection.cs
- SafeEventLogWriteHandle.cs
- DrawListViewColumnHeaderEventArgs.cs
- WhileDesigner.cs
- SystemWebSectionGroup.cs
- Point3DCollection.cs
- Size3D.cs
- IBuiltInEvidence.cs
- BuildProvidersCompiler.cs
- ReadOnlyDictionary.cs
- PartialArray.cs
- EncryptedHeaderXml.cs
- LogConverter.cs
- SortExpressionBuilder.cs
- AmbientProperties.cs
- BCryptNative.cs
- ProxyHwnd.cs
- PaperSize.cs
- MediaScriptCommandRoutedEventArgs.cs
- EntityStoreSchemaFilterEntry.cs
- documentation.cs
- DynamicDataManager.cs
- PolyQuadraticBezierSegment.cs
- ConsumerConnectionPointCollection.cs
- DelimitedListTraceListener.cs
- BasicHttpMessageSecurity.cs
- AuthenticateEventArgs.cs
- ChameleonKey.cs
- BooleanSwitch.cs
- BitStream.cs
- CultureTable.cs
- WorkflowDurableInstance.cs
- DataServiceException.cs
- NamedPipeAppDomainProtocolHandler.cs
- FormatException.cs
- XhtmlConformanceSection.cs
- HeaderedItemsControl.cs
- Html32TextWriter.cs
- TreeViewImageKeyConverter.cs
- Psha1DerivedKeyGeneratorHelper.cs
- HeaderFilter.cs
- ButtonFlatAdapter.cs
- BitmapMetadata.cs
- ReadOnlyHierarchicalDataSourceView.cs
- RowToFieldTransformer.cs
- BindingSource.cs
- CommandManager.cs
- UndoManager.cs
- TreeViewBindingsEditorForm.cs
- MarshalByValueComponent.cs
- TrustManagerMoreInformation.cs
- ExecutedRoutedEventArgs.cs
- FontFaceLayoutInfo.cs
- WebDescriptionAttribute.cs
- PointCollection.cs
- MimeWriter.cs
- HostingEnvironmentSection.cs
- GZipUtils.cs
- XNodeValidator.cs
- MasterPage.cs
- ReleaseInstanceMode.cs
- ResponseStream.cs
- SchemaNamespaceManager.cs
- AnnotationMap.cs
- Int32RectConverter.cs
- PermissionToken.cs
- WebServiceClientProxyGenerator.cs