Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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; } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Form.cs
- SecondaryIndex.cs
- SocketException.cs
- EndOfStreamException.cs
- XmlDocumentType.cs
- IsolatedStorageFileStream.cs
- RowParagraph.cs
- SystemTcpConnection.cs
- Simplifier.cs
- SqlMetaData.cs
- Icon.cs
- BuildProvidersCompiler.cs
- SyntaxCheck.cs
- LookupNode.cs
- RotationValidation.cs
- _CommandStream.cs
- UxThemeWrapper.cs
- InvokePattern.cs
- ExternalFile.cs
- CodeMethodReturnStatement.cs
- GACMembershipCondition.cs
- RegularExpressionValidator.cs
- NonVisualControlAttribute.cs
- InheritanceContextHelper.cs
- Group.cs
- TextServicesCompartment.cs
- X509RawDataKeyIdentifierClause.cs
- DeleteHelper.cs
- DESCryptoServiceProvider.cs
- CursorConverter.cs
- HttpModuleCollection.cs
- XpsStructure.cs
- RightsManagementInformation.cs
- ClientSettingsSection.cs
- BoolExpressionVisitors.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- PiiTraceSource.cs
- ServiceOperationListItemList.cs
- DateTimeFormatInfo.cs
- SinglePageViewer.cs
- XmlNamedNodeMap.cs
- XmlWrappingReader.cs
- XmlCustomFormatter.cs
- BooleanStorage.cs
- DetailsViewRowCollection.cs
- SaveFileDialogDesigner.cs
- MailDefinition.cs
- StoreConnection.cs
- FileSystemWatcher.cs
- DataGridViewHeaderCell.cs
- NonPrimarySelectionGlyph.cs
- DateTimeSerializationSection.cs
- PreservationFileWriter.cs
- DateTimePicker.cs
- RedirectionProxy.cs
- XmlSchemaType.cs
- NamespaceList.cs
- MenuItemStyleCollection.cs
- TypeContext.cs
- IERequestCache.cs
- SortDescription.cs
- MetadataWorkspace.cs
- DesignerToolStripControlHost.cs
- XmlWrappingWriter.cs
- SingleAnimationUsingKeyFrames.cs
- DefaultValidator.cs
- BoolLiteral.cs
- LocalValueEnumerator.cs
- Screen.cs
- SerializerDescriptor.cs
- Label.cs
- XPathArrayIterator.cs
- DetailsViewUpdatedEventArgs.cs
- Int16Converter.cs
- QuotedPrintableStream.cs
- WebPartPersonalization.cs
- ValueType.cs
- EncryptedReference.cs
- Composition.cs
- SelectionItemProviderWrapper.cs
- UpdateTracker.cs
- IdentifierElement.cs
- HandlerBase.cs
- LightweightEntityWrapper.cs
- StructuralCache.cs
- Dump.cs
- Buffer.cs
- HtmlInputSubmit.cs
- FrameworkElementAutomationPeer.cs
- RestHandler.cs
- sqlinternaltransaction.cs
- HttpListener.cs
- LineUtil.cs
- ToolStrip.cs
- indexingfiltermarshaler.cs
- StorageBasedPackageProperties.cs
- StretchValidation.cs
- SqlConnectionPoolProviderInfo.cs
- ErrorFormatterPage.cs
- _SslStream.cs