Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / CharEnumerator.cs / 1 / CharEnumerator.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: CharEnumerator ** ** ** Purpose: Enumerates the characters on a string. skips range ** checks. ** ** ============================================================*/ namespace System { using System.Collections; using System.Collections.Generic; [System.Runtime.InteropServices.ComVisible(true)] [Serializable] public sealed class CharEnumerator : IEnumerator, ICloneable, IEnumerator{ private String str; private int index; private char currentElement; internal CharEnumerator(String str) { this.str = str; this.index = -1; } public Object Clone() { return MemberwiseClone(); } public bool MoveNext() { if (index < (str.Length-1)) { index++; currentElement = str[index]; return true; } else index = str.Length; return false; } void IDisposable.Dispose() { } /// Object IEnumerator.Current { get { if (index == -1) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted)); if (index >= str.Length) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumEnded)); return currentElement; } } public char Current { get { if (index == -1) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted)); if (index >= str.Length) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumEnded)); return currentElement; } } public void Reset() { currentElement = (char)0; index = -1; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TableCellCollection.cs
- DictionaryChange.cs
- ZipIOBlockManager.cs
- DateTimeOffset.cs
- FastEncoder.cs
- InstancePersistenceEvent.cs
- PtsContext.cs
- TextBreakpoint.cs
- CodeAttributeDeclarationCollection.cs
- FacetChecker.cs
- MetadataArtifactLoaderCompositeResource.cs
- PackWebRequestFactory.cs
- PrivilegedConfigurationManager.cs
- Rect3DConverter.cs
- HttpCookiesSection.cs
- GroupJoinQueryOperator.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- MediaContext.cs
- Transactions.cs
- WebBrowserContainer.cs
- ImageList.cs
- TagPrefixAttribute.cs
- Scalars.cs
- ResourceReader.cs
- MimeFormImporter.cs
- WizardPanelChangingEventArgs.cs
- ByteArrayHelperWithString.cs
- ShaderEffect.cs
- DbMetaDataCollectionNames.cs
- GifBitmapEncoder.cs
- SqlDataReader.cs
- ApplicationGesture.cs
- mongolianshape.cs
- SafeReversePInvokeHandle.cs
- AsymmetricAlgorithm.cs
- HttpTransportManager.cs
- FontCacheLogic.cs
- ObjectReaderCompiler.cs
- _CacheStreams.cs
- DesignerActionList.cs
- XmlSchemaValidationException.cs
- ErrorTableItemStyle.cs
- FixedFlowMap.cs
- LinearQuaternionKeyFrame.cs
- PageSettings.cs
- BamlBinaryWriter.cs
- Rfc2898DeriveBytes.cs
- UmAlQuraCalendar.cs
- MaskDescriptor.cs
- CustomActivityDesigner.cs
- ComponentDispatcherThread.cs
- DataIdProcessor.cs
- AnnotationService.cs
- ActiveXHost.cs
- TemplateParser.cs
- FieldMetadata.cs
- Application.cs
- DataError.cs
- DataService.cs
- TransportBindingElementImporter.cs
- MailDefinition.cs
- DuplicateContext.cs
- CodeDOMProvider.cs
- SQLDateTime.cs
- HttpRequestWrapper.cs
- Baml2006ReaderSettings.cs
- Error.cs
- HttpProtocolImporter.cs
- ProcessHostServerConfig.cs
- Attributes.cs
- TextParagraphView.cs
- DefaultAsyncDataDispatcher.cs
- CommandConverter.cs
- SHA384Managed.cs
- ComboBoxRenderer.cs
- SimpleExpression.cs
- OleServicesContext.cs
- BufferedGraphicsManager.cs
- WebPartHelpVerb.cs
- XmlSchemaAttributeGroup.cs
- DescriptionAttribute.cs
- ChildTable.cs
- GridViewAutomationPeer.cs
- ToolStripSeparator.cs
- OdbcUtils.cs
- FillBehavior.cs
- Effect.cs
- ToolStripControlHost.cs
- FormsAuthenticationUser.cs
- GACMembershipCondition.cs
- MetadataArtifactLoaderCompositeResource.cs
- FixedSOMLineCollection.cs
- SchemaElement.cs
- StorageComplexTypeMapping.cs
- DataBoundControlDesigner.cs
- Cursors.cs
- TextBoxAutoCompleteSourceConverter.cs
- TypeGeneratedEventArgs.cs
- UnlockInstanceAsyncResult.cs
- WorkflowInstanceContextProvider.cs