Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- RSAOAEPKeyExchangeFormatter.cs
- MDIClient.cs
- Error.cs
- Point3DCollection.cs
- RegisteredDisposeScript.cs
- ObfuscateAssemblyAttribute.cs
- PenLineCapValidation.cs
- WindowsTab.cs
- COM2IProvidePropertyBuilderHandler.cs
- DataGridItemEventArgs.cs
- ListViewUpdateEventArgs.cs
- NamespaceQuery.cs
- MachineKey.cs
- HMACSHA384.cs
- Process.cs
- XPathAncestorIterator.cs
- FacetDescriptionElement.cs
- ProviderCommandInfoUtils.cs
- FontNamesConverter.cs
- DataGridColumnEventArgs.cs
- DriveNotFoundException.cs
- SocketException.cs
- ArrayElementGridEntry.cs
- ComboBox.cs
- EllipticalNodeOperations.cs
- DataErrorValidationRule.cs
- IndexingContentUnit.cs
- DateTimeUtil.cs
- XhtmlBasicTextBoxAdapter.cs
- AlternateView.cs
- Vector3DValueSerializer.cs
- XPathNodeInfoAtom.cs
- TextRange.cs
- TogglePattern.cs
- Int32AnimationUsingKeyFrames.cs
- EntityTypeBase.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- Lease.cs
- ReflectionTypeLoadException.cs
- ToolBar.cs
- GeneralTransformGroup.cs
- ComplexBindingPropertiesAttribute.cs
- QilIterator.cs
- TraceSource.cs
- RecognizerBase.cs
- XMLDiffLoader.cs
- ElementHost.cs
- IdentityReference.cs
- _ShellExpression.cs
- MultiplexingFormatMapping.cs
- TextServicesPropertyRanges.cs
- ListBox.cs
- TimeoutValidationAttribute.cs
- Polyline.cs
- CredentialSelector.cs
- EntityDataSource.cs
- PageHandlerFactory.cs
- StylusPointProperty.cs
- ApplicationServicesHostFactory.cs
- ListViewGroupItemCollection.cs
- AsymmetricSignatureFormatter.cs
- ToolStripItemCollection.cs
- ConstructorExpr.cs
- UnsafeNativeMethods.cs
- EventBuilder.cs
- SHA256CryptoServiceProvider.cs
- OleDbParameterCollection.cs
- ToolboxBitmapAttribute.cs
- CompilationUtil.cs
- StatusBar.cs
- RichTextBoxAutomationPeer.cs
- Pens.cs
- LineBreak.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- InputReport.cs
- SqlDataReader.cs
- StateMachineWorkflow.cs
- DockProviderWrapper.cs
- CustomErrorCollection.cs
- WebBrowserSiteBase.cs
- HttpHandlerActionCollection.cs
- ToolStripSeparatorRenderEventArgs.cs
- DbConnectionPoolOptions.cs
- DataExpression.cs
- ConnectionProviderAttribute.cs
- SmiMetaDataProperty.cs
- DataGridViewDataConnection.cs
- ProxyWebPartManager.cs
- ProvideValueServiceProvider.cs
- TypeLibraryHelper.cs
- TcpProcessProtocolHandler.cs
- CultureSpecificStringDictionary.cs
- CompilerError.cs
- _Win32.cs
- TimeSpanSecondsConverter.cs
- ChameleonKey.cs
- DataGridViewColumnHeaderCell.cs
- ModelItemDictionary.cs
- DataPagerField.cs
- DragAssistanceManager.cs