Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- TdsParserHelperClasses.cs
- DataSvcMapFileSerializer.cs
- OperatingSystem.cs
- FileAccessException.cs
- DocumentScope.cs
- AutomationPatternInfo.cs
- XmlElementAttributes.cs
- FolderBrowserDialog.cs
- CodeCatchClauseCollection.cs
- RelationHandler.cs
- DocumentXPathNavigator.cs
- MissingFieldException.cs
- DropSource.cs
- DelegateBodyWriter.cs
- SoundPlayer.cs
- CategoryAttribute.cs
- Label.cs
- MatrixUtil.cs
- ArrangedElementCollection.cs
- RectangleF.cs
- ScriptingProfileServiceSection.cs
- DataKey.cs
- BindingMAnagerBase.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- StopStoryboard.cs
- EventLogTraceListener.cs
- FrameworkReadOnlyPropertyMetadata.cs
- URL.cs
- TextBox.cs
- MetadataResolver.cs
- HeaderedItemsControl.cs
- SchemaTableColumn.cs
- UserPersonalizationStateInfo.cs
- ManagedCodeMarkers.cs
- ConfigurationStrings.cs
- OdbcErrorCollection.cs
- DesignerActionVerbList.cs
- HttpProfileBase.cs
- SoapSchemaExporter.cs
- InkPresenterAutomationPeer.cs
- DbProviderSpecificTypePropertyAttribute.cs
- StylusSystemGestureEventArgs.cs
- StringStorage.cs
- BitVec.cs
- Activation.cs
- ListControlDataBindingHandler.cs
- XmlLanguageConverter.cs
- DataGridClipboardHelper.cs
- HostVisual.cs
- XPathPatternBuilder.cs
- webproxy.cs
- SystemIPv4InterfaceProperties.cs
- WindowsIdentity.cs
- RegisteredHiddenField.cs
- MetadataItem_Static.cs
- DispatcherSynchronizationContext.cs
- OlePropertyStructs.cs
- CompositeActivityValidator.cs
- RuntimeVariableList.cs
- WebHostedComPlusServiceHost.cs
- HtmlDocument.cs
- SafeRightsManagementEnvironmentHandle.cs
- FirstMatchCodeGroup.cs
- ParserContext.cs
- MapPathBasedVirtualPathProvider.cs
- PointCollectionConverter.cs
- ContextBase.cs
- DesigntimeLicenseContext.cs
- KeyValuePairs.cs
- Crc32.cs
- ControlIdConverter.cs
- StorageAssociationTypeMapping.cs
- TaskFactory.cs
- ScalarOps.cs
- ExpressionBuilderContext.cs
- TransformerInfo.cs
- XamlValidatingReader.cs
- AdornedElementPlaceholder.cs
- _ListenerResponseStream.cs
- DataPager.cs
- Pkcs7Recipient.cs
- Control.cs
- AutoFocusStyle.xaml.cs
- BufferBuilder.cs
- BitmapInitialize.cs
- BitConverter.cs
- VisualBasicSettingsConverter.cs
- DynamicMethod.cs
- Italic.cs
- CompressedStack.cs
- WebPartMovingEventArgs.cs
- DocumentSequence.cs
- TextHidden.cs
- SoapExtensionTypeElementCollection.cs
- FixedDocumentSequencePaginator.cs
- AdornerDecorator.cs
- RepeatBehavior.cs
- QuaternionAnimation.cs
- ScriptResourceDefinition.cs
- SelectionHighlightInfo.cs