Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- UniqueIdentifierService.cs
- OracleParameter.cs
- IItemContainerGenerator.cs
- ValidationContext.cs
- webbrowsersite.cs
- LinqDataSourceUpdateEventArgs.cs
- StreamGeometryContext.cs
- TextServicesPropertyRanges.cs
- PixelFormatConverter.cs
- TdsParserHelperClasses.cs
- OdbcUtils.cs
- RawStylusInput.cs
- TextChangedEventArgs.cs
- SeekStoryboard.cs
- QueryStatement.cs
- GridEntry.cs
- TimeBoundedCache.cs
- DataGridViewTextBoxCell.cs
- WebContext.cs
- Style.cs
- LogExtent.cs
- RuntimeWrappedException.cs
- TextBox.cs
- AnnotationHelper.cs
- DropShadowEffect.cs
- NotifyParentPropertyAttribute.cs
- EraserBehavior.cs
- Rotation3DAnimationBase.cs
- LicFileLicenseProvider.cs
- XPathNavigatorReader.cs
- HtmlTitle.cs
- DataGridViewTopRowAccessibleObject.cs
- ServiceObjectContainer.cs
- Formatter.cs
- DataTableExtensions.cs
- ClientSettingsProvider.cs
- PointHitTestParameters.cs
- odbcmetadatafactory.cs
- FormViewPageEventArgs.cs
- DrawListViewColumnHeaderEventArgs.cs
- _UriSyntax.cs
- Accessors.cs
- ResourcePermissionBaseEntry.cs
- AffineTransform3D.cs
- UniqueConstraint.cs
- FixedFlowMap.cs
- MailBnfHelper.cs
- FilterQueryOptionExpression.cs
- JournalNavigationScope.cs
- MergeFailedEvent.cs
- EventManager.cs
- Pair.cs
- TextServicesDisplayAttributePropertyRanges.cs
- ModulesEntry.cs
- DefaultValueConverter.cs
- Point4DConverter.cs
- ConversionHelper.cs
- ParameterCollection.cs
- XmlChildEnumerator.cs
- _ProxyRegBlob.cs
- GeneralTransform.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- FtpCachePolicyElement.cs
- CodeObject.cs
- ProfileSettings.cs
- TreeNodeBindingCollection.cs
- MemoryResponseElement.cs
- BasicBrowserDialog.designer.cs
- SqlDataSourceStatusEventArgs.cs
- AutomationElement.cs
- CompilationUnit.cs
- NamespaceCollection.cs
- XmlSchemaType.cs
- TextEditorSelection.cs
- DataBindingCollectionEditor.cs
- SafeIUnknown.cs
- AspNetSynchronizationContext.cs
- PrefixHandle.cs
- DataSpaceManager.cs
- Shape.cs
- RulePatternOps.cs
- ObjectDataSourceStatusEventArgs.cs
- ConstructorNeedsTagAttribute.cs
- WebEventTraceProvider.cs
- ServiceContractViewControl.cs
- ResourceReferenceExpressionConverter.cs
- XmlReflectionMember.cs
- AbandonedMutexException.cs
- ProcessHostServerConfig.cs
- TextBox.cs
- TiffBitmapDecoder.cs
- QueryIntervalOp.cs
- XmlDocumentType.cs
- BulletDecorator.cs
- COM2PropertyPageUITypeConverter.cs
- ErrorRuntimeConfig.cs
- EventMap.cs
- AsymmetricCryptoHandle.cs
- CellLabel.cs
- UnicastIPAddressInformationCollection.cs