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
- FixedFlowMap.cs
- BoundsDrawingContextWalker.cs
- ToolboxComponentsCreatedEventArgs.cs
- BitmapImage.cs
- WindowShowOrOpenTracker.cs
- ProgressChangedEventArgs.cs
- DBConnection.cs
- RepeatInfo.cs
- ConnectivityStatus.cs
- QueryRewriter.cs
- FontCacheLogic.cs
- ClientBuildManager.cs
- _HTTPDateParse.cs
- LinqDataSourceEditData.cs
- IntegrationExceptionEventArgs.cs
- DrawingImage.cs
- OracleTransaction.cs
- MailSettingsSection.cs
- util.cs
- ReferentialConstraint.cs
- QuestionEventArgs.cs
- HttpCacheVary.cs
- ItemChangedEventArgs.cs
- Double.cs
- Pair.cs
- SingleAnimation.cs
- HttpListenerException.cs
- ToolStripItemClickedEventArgs.cs
- QueryPageSettingsEventArgs.cs
- cookiecollection.cs
- DataBoundControlParameterTarget.cs
- SiteOfOriginPart.cs
- ProvidePropertyAttribute.cs
- Panel.cs
- CodeSubDirectoriesCollection.cs
- SectionVisual.cs
- DashStyle.cs
- ResourceDictionaryCollection.cs
- Rect.cs
- ProcessHost.cs
- TextEditorMouse.cs
- ObjectDataSource.cs
- SqlBuffer.cs
- PageBreakRecord.cs
- InlineUIContainer.cs
- TextSelectionProcessor.cs
- Constants.cs
- ScaleTransform.cs
- ObjectDataSourceChooseTypePanel.cs
- TextControl.cs
- XmlSchemaAttributeGroup.cs
- ProjectionPlanCompiler.cs
- Positioning.cs
- SingleTagSectionHandler.cs
- GZipStream.cs
- WebServiceEnumData.cs
- Rotation3DAnimation.cs
- NamedPipeTransportBindingElement.cs
- TransformedBitmap.cs
- WebGetAttribute.cs
- WriteStateInfoBase.cs
- SingleAnimationBase.cs
- nulltextnavigator.cs
- precedingquery.cs
- ScrollPatternIdentifiers.cs
- DbProviderManifest.cs
- CompilationSection.cs
- ObjectDataSourceView.cs
- CssClassPropertyAttribute.cs
- GridViewDeleteEventArgs.cs
- UrlMappingsModule.cs
- EndpointReference.cs
- Bidi.cs
- Command.cs
- DynamicFilterExpression.cs
- BrowserTree.cs
- NotifyInputEventArgs.cs
- UnsafeMethods.cs
- PrimitiveSchema.cs
- PageHandlerFactory.cs
- ListViewContainer.cs
- FloaterParagraph.cs
- BindStream.cs
- FormViewCommandEventArgs.cs
- SQLDateTimeStorage.cs
- InstanceCollisionException.cs
- BamlTreeMap.cs
- XomlCompilerHelpers.cs
- ReadWriteObjectLock.cs
- ResXBuildProvider.cs
- OracleCommandSet.cs
- DependencyObjectPropertyDescriptor.cs
- ExtensionFile.cs
- DefaultAutoFieldGenerator.cs
- TraceContext.cs
- CopyAction.cs
- PerspectiveCamera.cs
- OleServicesContext.cs
- CacheSection.cs
- EditingCommands.cs