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
- XmlWellformedWriter.cs
- LabelExpression.cs
- RedirectionProxy.cs
- NotifyCollectionChangedEventArgs.cs
- ToolStripDesignerAvailabilityAttribute.cs
- RepeatBehavior.cs
- XamlInt32CollectionSerializer.cs
- AssemblyAttributesGoHere.cs
- ScriptingWebServicesSectionGroup.cs
- WebPartEditorApplyVerb.cs
- ConversionContext.cs
- NavigationPropertySingletonExpression.cs
- AsyncDataRequest.cs
- UInt16Converter.cs
- EventLogPermissionEntry.cs
- NetworkInformationException.cs
- PseudoWebRequest.cs
- TabItem.cs
- InvalidOleVariantTypeException.cs
- Gdiplus.cs
- HtmlInputButton.cs
- IdnMapping.cs
- FontStretch.cs
- RequestContext.cs
- RequestSecurityTokenResponse.cs
- CryptoHelper.cs
- XslCompiledTransform.cs
- DynamicMetaObjectBinder.cs
- SpeechUI.cs
- KnownBoxes.cs
- DoubleConverter.cs
- BaseTemplateBuildProvider.cs
- XPathExpr.cs
- XamlTemplateSerializer.cs
- CryptoHandle.cs
- RSAPKCS1SignatureDeformatter.cs
- EnumerableRowCollectionExtensions.cs
- Roles.cs
- SmiContextFactory.cs
- DashStyles.cs
- TypeConverterMarkupExtension.cs
- GridViewRowPresenterBase.cs
- CodeIterationStatement.cs
- AsyncResult.cs
- WebPartZoneBase.cs
- ExceptionRoutedEventArgs.cs
- EntityDataSourceContextCreatedEventArgs.cs
- SecurityRuntime.cs
- CodeExporter.cs
- ExpressionVisitor.cs
- Setter.cs
- SHA384Managed.cs
- CellCreator.cs
- ListBoxDesigner.cs
- TextDataBindingHandler.cs
- DesignTimeParseData.cs
- TileBrush.cs
- DataControlLinkButton.cs
- SynchronizationContext.cs
- Debug.cs
- DeviceContext.cs
- SoapHeaders.cs
- TableTextElementCollectionInternal.cs
- TreeBuilder.cs
- ArgumentOutOfRangeException.cs
- GB18030Encoding.cs
- WebColorConverter.cs
- ISAPIWorkerRequest.cs
- ListItem.cs
- MsmqIntegrationBinding.cs
- AsymmetricAlgorithm.cs
- RtfFormatStack.cs
- MainMenu.cs
- KeyProperty.cs
- SignerInfo.cs
- PresentationAppDomainManager.cs
- EditableTreeList.cs
- DataControlReference.cs
- RangeValuePatternIdentifiers.cs
- PageAdapter.cs
- AssemblyName.cs
- FontFaceLayoutInfo.cs
- DebuggerService.cs
- MenuItem.cs
- ByteStorage.cs
- InvokeMemberBinder.cs
- userdatakeys.cs
- AccessKeyManager.cs
- AssociationTypeEmitter.cs
- XmlAttributeAttribute.cs
- VectorAnimation.cs
- LinearKeyFrames.cs
- TextElementCollection.cs
- TextSegment.cs
- JsonServiceDocumentSerializer.cs
- ProtectedConfiguration.cs
- ValueOfAction.cs
- SqlFacetAttribute.cs
- RegexCharClass.cs
- ServerIdentity.cs