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
- ResourceReader.cs
- OdbcEnvironment.cs
- LineSegment.cs
- ControlUtil.cs
- HyperLinkColumn.cs
- QualificationDataAttribute.cs
- ListenerElementsCollection.cs
- SoapProtocolImporter.cs
- ClientFormsIdentity.cs
- ExpandSegmentCollection.cs
- DefaultTextStore.cs
- AnimationLayer.cs
- SimpleMailWebEventProvider.cs
- EmptyEnumerator.cs
- RootProfilePropertySettingsCollection.cs
- DataGridViewRowsAddedEventArgs.cs
- UIAgentAsyncBeginRequest.cs
- FrameworkTemplate.cs
- FacetEnabledSchemaElement.cs
- WSFederationHttpBinding.cs
- ScalarConstant.cs
- TextFormatter.cs
- BinaryKeyIdentifierClause.cs
- ExecutionContext.cs
- ListView.cs
- ApplicationFileCodeDomTreeGenerator.cs
- DateTimeFormatInfoScanner.cs
- PassportAuthenticationEventArgs.cs
- XmlSchemaProviderAttribute.cs
- ServicePointManagerElement.cs
- PreApplicationStartMethodAttribute.cs
- ReadOnlyDataSourceView.cs
- backend.cs
- EntityParameter.cs
- TableAdapterManagerHelper.cs
- FormatStringEditor.cs
- DataBinding.cs
- StyleConverter.cs
- ArrayConverter.cs
- EntityClientCacheEntry.cs
- CompletedAsyncResult.cs
- Msec.cs
- PingOptions.cs
- odbcmetadatacolumnnames.cs
- MemberPath.cs
- TrackingProfile.cs
- BuildProvidersCompiler.cs
- HttpCookieCollection.cs
- WebPartConnectionsEventArgs.cs
- ActivityExecutionContextCollection.cs
- SingleTagSectionHandler.cs
- XslTransform.cs
- RsaSecurityTokenParameters.cs
- CreateUserWizard.cs
- XamlDesignerSerializationManager.cs
- NegotiationTokenAuthenticator.cs
- XPathCompileException.cs
- _BasicClient.cs
- ThreadSafeList.cs
- BridgeDataRecord.cs
- PersianCalendar.cs
- _SingleItemRequestCache.cs
- Query.cs
- PerformanceCounterCategory.cs
- ResolveNameEventArgs.cs
- InputReferenceExpression.cs
- MenuItemBinding.cs
- Crc32.cs
- AttributeCollection.cs
- RenderCapability.cs
- SchemaImporterExtension.cs
- CounterCreationData.cs
- ConfigurationException.cs
- SafeWaitHandle.cs
- Msmq.cs
- RulePatternOps.cs
- CodeExpressionCollection.cs
- PropertyGeneratedEventArgs.cs
- TypeDependencyAttribute.cs
- HTMLTextWriter.cs
- BitmapEffectDrawing.cs
- ComponentRenameEvent.cs
- HtmlInputImage.cs
- XmlMembersMapping.cs
- TreeNodeSelectionProcessor.cs
- Peer.cs
- CompiledXpathExpr.cs
- BoolExpressionVisitors.cs
- SynchronizedInputProviderWrapper.cs
- PagePropertiesChangingEventArgs.cs
- WorkflowOwnershipException.cs
- IssuanceTokenProviderBase.cs
- ListControlDesigner.cs
- HtmlTernaryTree.cs
- XmlSchemaAttributeGroupRef.cs
- RadioButtonBaseAdapter.cs
- TracingConnection.cs
- HeaderedContentControl.cs
- AsyncResult.cs
- ContactManager.cs