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
- ArraySubsetEnumerator.cs
- TabControlAutomationPeer.cs
- Random.cs
- Guid.cs
- Vector3DConverter.cs
- QilStrConcatenator.cs
- DispatcherExceptionFilterEventArgs.cs
- WebPartZoneBaseDesigner.cs
- Serializer.cs
- EventQueueState.cs
- MultipartContentParser.cs
- MsmqIntegrationMessagePool.cs
- DtdParser.cs
- PartialClassGenerationTaskInternal.cs
- AttachedPropertyBrowsableAttribute.cs
- XmlnsDictionary.cs
- Mutex.cs
- InternalUserCancelledException.cs
- sortedlist.cs
- ALinqExpressionVisitor.cs
- XPathNodeInfoAtom.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- QilStrConcat.cs
- FileDialogCustomPlaces.cs
- SqlXml.cs
- ReadOnlyDataSourceView.cs
- SynchronizedDisposablePool.cs
- Misc.cs
- NonValidatingSecurityTokenAuthenticator.cs
- PerformanceCounterPermissionEntry.cs
- WS2007HttpBindingElement.cs
- TableLayoutCellPaintEventArgs.cs
- TextTreeDeleteContentUndoUnit.cs
- PkcsMisc.cs
- JsonEncodingStreamWrapper.cs
- HatchBrush.cs
- documentsequencetextview.cs
- TableCellCollection.cs
- SweepDirectionValidation.cs
- HttpCachePolicy.cs
- ReadOnlyDataSourceView.cs
- ResourceManagerWrapper.cs
- CodeExpressionStatement.cs
- UriScheme.cs
- SuppressIldasmAttribute.cs
- LinkGrep.cs
- HwndHost.cs
- WebControlsSection.cs
- SecurityDocument.cs
- ServicePoint.cs
- ConfigurationProviderException.cs
- BuilderPropertyEntry.cs
- GeometryDrawing.cs
- ClipboardData.cs
- LinqExpressionNormalizer.cs
- CodeIdentifiers.cs
- ClrProviderManifest.cs
- TimerElapsedEvenArgs.cs
- ResXResourceWriter.cs
- ChannelCacheDefaults.cs
- DeviceFilterEditorDialog.cs
- BitmapSourceSafeMILHandle.cs
- FileNotFoundException.cs
- WebRequestModuleElement.cs
- CertificateManager.cs
- Button.cs
- BitmapEffectInput.cs
- MaterialCollection.cs
- ClassImporter.cs
- _KerberosClient.cs
- Quaternion.cs
- MailMessage.cs
- CollectionBase.cs
- GradientStopCollection.cs
- DefaultMergeHelper.cs
- X509CertificateCollection.cs
- WindowsComboBox.cs
- CodeTypeParameter.cs
- Button.cs
- DataGridViewUtilities.cs
- InvokeMemberBinder.cs
- CodeTypeParameterCollection.cs
- ControlIdConverter.cs
- HWStack.cs
- StrongNameSignatureInformation.cs
- MemberDescriptor.cs
- PrinterUnitConvert.cs
- FrameworkContentElementAutomationPeer.cs
- RichTextBox.cs
- SqlError.cs
- DispatchWrapper.cs
- ParseChildrenAsPropertiesAttribute.cs
- XmlSchemaAnnotated.cs
- XhtmlConformanceSection.cs
- CodeConditionStatement.cs
- BitmapMetadataEnumerator.cs
- ProtocolViolationException.cs
- MatrixTransform3D.cs
- DictionaryBase.cs
- DatagridviewDisplayedBandsData.cs