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
- UrlAuthFailedErrorFormatter.cs
- UnknownBitmapEncoder.cs
- ExpressionEditorAttribute.cs
- TreeViewHitTestInfo.cs
- ToolStripGrip.cs
- DoubleUtil.cs
- ICspAsymmetricAlgorithm.cs
- LocatorGroup.cs
- TextElementEnumerator.cs
- StretchValidation.cs
- UInt16Storage.cs
- LocalizedNameDescriptionPair.cs
- SortedSetDebugView.cs
- MenuTracker.cs
- CSharpCodeProvider.cs
- AdornedElementPlaceholder.cs
- Certificate.cs
- ToolStripItemImageRenderEventArgs.cs
- BindingNavigator.cs
- HandlerFactoryCache.cs
- DefaultClaimSet.cs
- _NTAuthentication.cs
- DeviceContext2.cs
- ExecutionContext.cs
- ZipIOFileItemStream.cs
- IISMapPath.cs
- DelayLoadType.cs
- C14NUtil.cs
- SchemaElementDecl.cs
- AssemblyInfo.cs
- RequestFactory.cs
- RecognizedWordUnit.cs
- PeerNodeTraceRecord.cs
- ClientType.cs
- EncoderNLS.cs
- AssemblyBuilder.cs
- DataGridViewDataConnection.cs
- FunctionQuery.cs
- XmlChoiceIdentifierAttribute.cs
- FieldNameLookup.cs
- PersonalizationProvider.cs
- ToolstripProfessionalRenderer.cs
- SpellerHighlightLayer.cs
- ControlType.cs
- SqlCrossApplyToCrossJoin.cs
- RequestResizeEvent.cs
- BindingExpressionBase.cs
- CertificateManager.cs
- CounterSet.cs
- IsolatedStorage.cs
- InputScopeConverter.cs
- StringBuilder.cs
- InputScopeNameConverter.cs
- Single.cs
- Span.cs
- WS2007HttpBindingElement.cs
- ClassicBorderDecorator.cs
- DigitShape.cs
- TableNameAttribute.cs
- TableRow.cs
- CompModSwitches.cs
- HitTestDrawingContextWalker.cs
- HMACSHA384.cs
- unsafenativemethodstextservices.cs
- NamedElement.cs
- HttpCapabilitiesSectionHandler.cs
- XmlTextAttribute.cs
- Viewport3DAutomationPeer.cs
- _BaseOverlappedAsyncResult.cs
- GatewayIPAddressInformationCollection.cs
- WebServiceClientProxyGenerator.cs
- SettingsPropertyValueCollection.cs
- WebPartCancelEventArgs.cs
- COM2TypeInfoProcessor.cs
- Parameter.cs
- CodeGeneratorOptions.cs
- Rfc2898DeriveBytes.cs
- NativeMethods.cs
- XmlSchemaAttributeGroupRef.cs
- TraceContextEventArgs.cs
- DataPagerFieldItem.cs
- GridViewAutomationPeer.cs
- XmlWriter.cs
- Duration.cs
- FormViewPageEventArgs.cs
- DetailsViewInsertEventArgs.cs
- TablePattern.cs
- InfiniteIntConverter.cs
- RtfToXamlLexer.cs
- FixedSOMPageConstructor.cs
- DictionaryBase.cs
- GraphicsPath.cs
- ConfigXmlCDataSection.cs
- PolyBezierSegment.cs
- MessageQueueInstaller.cs
- DeferredReference.cs
- GradientBrush.cs
- TypeExtensionSerializer.cs
- Triangle.cs
- DataGridClipboardCellContent.cs