Code:
/ FX-1434 / FX-1434 / 1.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
- NullExtension.cs
- SqlMethodAttribute.cs
- MouseGestureValueSerializer.cs
- BaseTemplateBuildProvider.cs
- HtmlInputControl.cs
- ScopelessEnumAttribute.cs
- Panel.cs
- SafeEventLogReadHandle.cs
- TemplateEditingVerb.cs
- DrawToolTipEventArgs.cs
- BoundPropertyEntry.cs
- LiteralControl.cs
- RegularExpressionValidator.cs
- StreamGeometry.cs
- CodeDomDecompiler.cs
- QuaternionIndependentAnimationStorage.cs
- RegistryPermission.cs
- StorageScalarPropertyMapping.cs
- CodeMemberMethod.cs
- ActivityValidator.cs
- TlsSspiNegotiation.cs
- RegistryKey.cs
- SyntaxCheck.cs
- ConditionedDesigner.cs
- TableItemPatternIdentifiers.cs
- QilGenerator.cs
- SqlIdentifier.cs
- DnsEndPoint.cs
- SchemaCollectionPreprocessor.cs
- EntityDataSourceContainerNameItem.cs
- RtfControlWordInfo.cs
- PauseStoryboard.cs
- SHA256CryptoServiceProvider.cs
- _NetRes.cs
- DataSourceCache.cs
- DefaultTraceListener.cs
- TypeListConverter.cs
- UIElementPropertyUndoUnit.cs
- BitmapSource.cs
- XmlWriterSettings.cs
- Setter.cs
- DataGridTablesFactory.cs
- TextSelectionHighlightLayer.cs
- AssemblySettingAttributes.cs
- ObjectConverter.cs
- CommandSet.cs
- MiniAssembly.cs
- FontFaceLayoutInfo.cs
- Stack.cs
- InvokeBinder.cs
- AppDomainProtocolHandler.cs
- GridViewActionList.cs
- ActiveXSite.cs
- _FtpDataStream.cs
- ResXResourceReader.cs
- HealthMonitoringSection.cs
- AnnotationHelper.cs
- keycontainerpermission.cs
- GeneralTransformCollection.cs
- MenuAutoFormat.cs
- TdsRecordBufferSetter.cs
- TypeReference.cs
- X500Name.cs
- WMICapabilities.cs
- WindowsListViewSubItem.cs
- CheckBoxRenderer.cs
- StringAnimationBase.cs
- ProviderCollection.cs
- IPAddress.cs
- SvcMapFile.cs
- SessionStateSection.cs
- RegistryDataKey.cs
- ColumnMapProcessor.cs
- XmlAggregates.cs
- VerificationException.cs
- ComEventsHelper.cs
- exports.cs
- unsafenativemethodsother.cs
- PresentationTraceSources.cs
- DbProviderFactoriesConfigurationHandler.cs
- ScrollBarAutomationPeer.cs
- DirectoryNotFoundException.cs
- counter.cs
- DataGridViewColumnCollection.cs
- TemplatedWizardStep.cs
- SqlClientWrapperSmiStreamChars.cs
- CustomError.cs
- TreeNode.cs
- SafeNativeMethodsOther.cs
- ThrowOnMultipleAssignment.cs
- DesignerAttributeInfo.cs
- ConfigurationStrings.cs
- SecurityAlgorithmSuiteConverter.cs
- ConfigXmlSignificantWhitespace.cs
- UniqueEventHelper.cs
- XmlRawWriter.cs
- PrintDocument.cs
- StringComparer.cs
- WindowsAltTab.cs
- SendReply.cs