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
- SqlProfileProvider.cs
- DNS.cs
- HttpCachePolicyWrapper.cs
- EmptyCollection.cs
- XPathDescendantIterator.cs
- SymbolMethod.cs
- StreamMarshaler.cs
- PerformanceCounterManager.cs
- LazyTextWriterCreator.cs
- CompensationDesigner.cs
- ReliableDuplexSessionChannel.cs
- DataContractSerializer.cs
- BulletedListEventArgs.cs
- XmlTextEncoder.cs
- DoubleAnimationClockResource.cs
- VoiceSynthesis.cs
- HtmlTableRowCollection.cs
- HealthMonitoringSectionHelper.cs
- WinInetCache.cs
- EntityDataSource.cs
- TextEndOfSegment.cs
- Lazy.cs
- ShaderEffect.cs
- DataRow.cs
- BoolExpr.cs
- ValueSerializerAttribute.cs
- StringWriter.cs
- HierarchicalDataBoundControl.cs
- Vector.cs
- TrustManager.cs
- BitmapEffectState.cs
- TypedRowHandler.cs
- HMACSHA256.cs
- Rss20ItemFormatter.cs
- StreamInfo.cs
- SoapSchemaMember.cs
- ReadOnlyDataSource.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- WebPartEditorOkVerb.cs
- MultiDataTrigger.cs
- EmptyReadOnlyDictionaryInternal.cs
- GeometryCollection.cs
- WebPartEditorApplyVerb.cs
- DataGridViewDataErrorEventArgs.cs
- XmlSerializationReader.cs
- DataRowChangeEvent.cs
- Int16Animation.cs
- BeginStoryboard.cs
- XamlPointCollectionSerializer.cs
- NegotiationTokenAuthenticator.cs
- TextProperties.cs
- SqlDataSourceDesigner.cs
- UnknownBitmapDecoder.cs
- MethodCallExpression.cs
- DrawingGroup.cs
- XmlSchemaComplexContentExtension.cs
- ComplexPropertyEntry.cs
- StaticTextPointer.cs
- QueryCorrelationInitializer.cs
- DBProviderConfigurationHandler.cs
- DiscoveryClient.cs
- StorageSetMapping.cs
- DbConnectionOptions.cs
- Misc.cs
- ConsoleKeyInfo.cs
- DigestComparer.cs
- SerializerProvider.cs
- LiteralControl.cs
- UDPClient.cs
- DataGridViewImageCell.cs
- PointValueSerializer.cs
- FilterableAttribute.cs
- DataObjectAttribute.cs
- MemberMaps.cs
- RadioButtonFlatAdapter.cs
- DEREncoding.cs
- TabPage.cs
- ActivityCodeDomSerializer.cs
- URLAttribute.cs
- WebBrowserEvent.cs
- PropertyEntry.cs
- Keyboard.cs
- URL.cs
- PageCopyCount.cs
- LinqDataSourceView.cs
- Object.cs
- XmlSchemaSubstitutionGroup.cs
- SystemIPGlobalStatistics.cs
- MetadataItem_Static.cs
- LexicalChunk.cs
- storepermissionattribute.cs
- Model3D.cs
- ValidatedControlConverter.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- EntityPropertyMappingAttribute.cs
- PingReply.cs
- CodeValidator.cs
- MaskedTextProvider.cs
- HyperlinkAutomationPeer.cs
- AuthenticodeSignatureInformation.cs