Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XamlFigureLengthSerializer.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- LiteralTextParser.cs
- HttpServerUtilityBase.cs
- MemberCollection.cs
- FontNamesConverter.cs
- MappingMetadataHelper.cs
- TextElementEnumerator.cs
- TransformerConfigurationWizardBase.cs
- CellTreeNodeVisitors.cs
- ScaleTransform.cs
- SinglePageViewer.cs
- BuildProviderUtils.cs
- HTTPNotFoundHandler.cs
- UIntPtr.cs
- Freezable.cs
- ComponentRenameEvent.cs
- SharedConnectionInfo.cs
- JapaneseCalendar.cs
- DynamicRenderer.cs
- XmlFormatReaderGenerator.cs
- TextEffect.cs
- WizardForm.cs
- DrawingBrush.cs
- Paragraph.cs
- CellTreeSimplifier.cs
- CharacterMetricsDictionary.cs
- MemoryRecordBuffer.cs
- ApplicationSecurityInfo.cs
- RightsManagementPermission.cs
- Pipe.cs
- WindowAutomationPeer.cs
- DeferredTextReference.cs
- SplashScreenNativeMethods.cs
- documentsequencetextcontainer.cs
- Overlapped.cs
- SQLBinary.cs
- AstTree.cs
- Delegate.cs
- ZipIOExtraField.cs
- InstalledFontCollection.cs
- RoutedUICommand.cs
- MsmqEncryptionAlgorithm.cs
- PrivateFontCollection.cs
- ExtensionDataObject.cs
- XmlNamedNodeMap.cs
- DataGridViewColumnStateChangedEventArgs.cs
- _Semaphore.cs
- RunClient.cs
- DataGridViewRowConverter.cs
- COM2ExtendedUITypeEditor.cs
- MouseCaptureWithinProperty.cs
- MenuItem.cs
- FormViewDeleteEventArgs.cs
- InputElement.cs
- IgnoreFlushAndCloseStream.cs
- DataAdapter.cs
- RewritingSimplifier.cs
- UIElementHelper.cs
- ClaimSet.cs
- activationcontext.cs
- ColorInterpolationModeValidation.cs
- Misc.cs
- EntityDesignerDataSourceView.cs
- WindowInteropHelper.cs
- HTTPNotFoundHandler.cs
- VerificationException.cs
- FormsAuthenticationModule.cs
- AspNetSynchronizationContext.cs
- DiscoveryMessageSequenceGenerator.cs
- SystemIPv6InterfaceProperties.cs
- ParameterModifier.cs
- Random.cs
- XhtmlCssHandler.cs
- GlyphInfoList.cs
- TypeLoadException.cs
- ObjectQueryState.cs
- GPRECT.cs
- QueryAccessibilityHelpEvent.cs
- Sql8ExpressionRewriter.cs
- CursorConverter.cs
- WebRequestModuleElementCollection.cs
- MatrixCamera.cs
- HttpConfigurationContext.cs
- OptimizedTemplateContentHelper.cs
- AnnotationAdorner.cs
- HTMLTextWriter.cs
- StyleBamlRecordReader.cs
- FilteredDataSetHelper.cs
- FontDialog.cs
- ModuleConfigurationInfo.cs
- SqlUtil.cs
- TypeNameConverter.cs
- Timer.cs
- TreeViewHitTestInfo.cs
- HttpBindingExtension.cs
- DoubleAnimationBase.cs
- ValueConversionAttribute.cs
- PeerNearMe.cs
- Comparer.cs