Code:
/ DotNET / DotNET / 8.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
- ADConnectionHelper.cs
- categoryentry.cs
- _DomainName.cs
- ViewStateException.cs
- DesignerAutoFormat.cs
- SizeAnimationBase.cs
- Window.cs
- HttpConfigurationContext.cs
- InternalConfigEventArgs.cs
- RightsManagementErrorHandler.cs
- SpAudioStreamWrapper.cs
- SQLString.cs
- EditorPartChrome.cs
- DataContract.cs
- DeliveryStrategy.cs
- RuntimeEnvironment.cs
- FlatButtonAppearance.cs
- Int32Animation.cs
- OleDbPermission.cs
- ElementHost.cs
- AttachmentService.cs
- ValidationContext.cs
- SoapInteropTypes.cs
- TimeoutStream.cs
- ZoneMembershipCondition.cs
- StoreContentChangedEventArgs.cs
- DataGrid.cs
- DependencyPropertyKey.cs
- DataBoundLiteralControl.cs
- LineMetrics.cs
- DataGridRowClipboardEventArgs.cs
- UriTemplateDispatchFormatter.cs
- UnionExpr.cs
- SamlEvidence.cs
- FormViewRow.cs
- DataGridBoolColumn.cs
- PagedDataSource.cs
- CopyAttributesAction.cs
- Trace.cs
- PackagePart.cs
- SqlUtils.cs
- LineServices.cs
- DataChangedEventManager.cs
- DynamicControlParameter.cs
- SimpleTypeResolver.cs
- TargetParameterCountException.cs
- ExpressionBuilder.cs
- BrushMappingModeValidation.cs
- FileSecurity.cs
- PrintDocument.cs
- OrderedDictionary.cs
- TimeSpanOrInfiniteValidator.cs
- LogicalCallContext.cs
- ObjectDataSourceSelectingEventArgs.cs
- CacheEntry.cs
- TCEAdapterGenerator.cs
- ComplexObject.cs
- ComponentRenameEvent.cs
- DragDropManager.cs
- BuilderPropertyEntry.cs
- ParentQuery.cs
- TitleStyle.cs
- XmlSerializerVersionAttribute.cs
- ScriptDescriptor.cs
- XmlSchemaAny.cs
- FrameworkTextComposition.cs
- HostingMessageProperty.cs
- DataControlPagerLinkButton.cs
- ThreadWorkerController.cs
- SvcMapFileLoader.cs
- HtmlWindow.cs
- AttributeCollection.cs
- NavigationPropertyEmitter.cs
- HasCopySemanticsAttribute.cs
- TriState.cs
- ContextProperty.cs
- ResXDataNode.cs
- EnumValAlphaComparer.cs
- BindingGroup.cs
- ITreeGenerator.cs
- MultiPartWriter.cs
- DependencyPropertyAttribute.cs
- PartManifestEntry.cs
- SQLCharsStorage.cs
- NetworkAddressChange.cs
- ColumnClickEvent.cs
- ObjectDataSourceDisposingEventArgs.cs
- ResourceExpressionBuilder.cs
- SoapFault.cs
- Context.cs
- AssemblyName.cs
- counter.cs
- ReadOnlyCollection.cs
- ImageSource.cs
- ImageDrawing.cs
- MLangCodePageEncoding.cs
- InkCanvas.cs
- ListViewGroupConverter.cs
- WebPartZone.cs
- ViewCellRelation.cs