Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // // ==--== /*============================================================ ** ** 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WorkflowClientDeliverMessageWrapper.cs
- GridView.cs
- ConfigUtil.cs
- FragmentQueryKB.cs
- FacetValueContainer.cs
- PlatformNotSupportedException.cs
- COM2PropertyDescriptor.cs
- HttpHandlerAction.cs
- OverrideMode.cs
- LinkedList.cs
- OperationContractGenerationContext.cs
- BamlTreeMap.cs
- mongolianshape.cs
- mediapermission.cs
- MailMessage.cs
- SerializationEventsCache.cs
- DecoderBestFitFallback.cs
- TextServicesCompartmentEventSink.cs
- StorageComplexPropertyMapping.cs
- ComponentDispatcherThread.cs
- StringDictionaryCodeDomSerializer.cs
- PrincipalPermission.cs
- ViewStateException.cs
- WindowsStatic.cs
- InstrumentationTracker.cs
- IndexedWhereQueryOperator.cs
- SmtpReplyReaderFactory.cs
- PropertyGrid.cs
- WorkflowMarkupSerializer.cs
- prefixendpointaddressmessagefiltertable.cs
- WinFormsUtils.cs
- SerialStream.cs
- CodeParameterDeclarationExpression.cs
- EventLogEntry.cs
- ExtendedProtectionPolicy.cs
- GradientStop.cs
- SwitchLevelAttribute.cs
- PrivateFontCollection.cs
- StrokeRenderer.cs
- HuffCodec.cs
- SiteOfOriginPart.cs
- SqlExpressionNullability.cs
- login.cs
- SpeechEvent.cs
- Thickness.cs
- FrameworkContentElementAutomationPeer.cs
- ISAPIApplicationHost.cs
- TypefaceMap.cs
- NeutralResourcesLanguageAttribute.cs
- StackSpiller.Bindings.cs
- ModuleBuilderData.cs
- X509LogoTypeExtension.cs
- WindowsGraphicsCacheManager.cs
- InstallerTypeAttribute.cs
- UnionCqlBlock.cs
- Int64Animation.cs
- DrawingContextDrawingContextWalker.cs
- DrawingCollection.cs
- EntityDataSourceStatementEditor.cs
- RoleManagerModule.cs
- AssociationEndMember.cs
- QueryGenerator.cs
- EdmProviderManifest.cs
- ClassicBorderDecorator.cs
- SchemaTypeEmitter.cs
- ProcessThread.cs
- BitmapImage.cs
- QueryCursorEventArgs.cs
- StateMachineAction.cs
- Collection.cs
- CharAnimationBase.cs
- WizardStepBase.cs
- IconConverter.cs
- ContentIterators.cs
- unsafeIndexingFilterStream.cs
- Point3DConverter.cs
- JsonReader.cs
- Single.cs
- TextParagraph.cs
- InvalidDataException.cs
- DictionaryEntry.cs
- TemplatePartAttribute.cs
- PageParser.cs
- MDIClient.cs
- CharStorage.cs
- InputBuffer.cs
- ListControl.cs
- TransformConverter.cs
- ServiceOperationListItem.cs
- UnicodeEncoding.cs
- ScaleTransform3D.cs
- DependencyProperty.cs
- NonBatchDirectoryCompiler.cs
- StringHelper.cs
- GraphicsContainer.cs
- DateTimeUtil.cs
- MemberInfoSerializationHolder.cs
- WaitHandle.cs
- CodeParameterDeclarationExpression.cs
- DefaultEventAttribute.cs