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
- PreviewPageInfo.cs
- ControlIdConverter.cs
- EntityDataSource.cs
- ColumnHeader.cs
- HttpListenerTimeoutManager.cs
- ItemContainerGenerator.cs
- XmlMapping.cs
- TableRow.cs
- Rfc2898DeriveBytes.cs
- CurrentTimeZone.cs
- documentation.cs
- WebConfigurationManager.cs
- ChangeProcessor.cs
- XmlSignatureProperties.cs
- GPRECTF.cs
- SqlXmlStorage.cs
- ResourcePermissionBase.cs
- WindowsStatic.cs
- Main.cs
- WebPermission.cs
- FontStretch.cs
- SoapIgnoreAttribute.cs
- HintTextConverter.cs
- ContainerControl.cs
- TextBounds.cs
- DrawToolTipEventArgs.cs
- InfoCardMetadataExchangeClient.cs
- SchemaMerger.cs
- ISFTagAndGuidCache.cs
- SQLInt16.cs
- EndpointAddress.cs
- BitmapEffectDrawing.cs
- EditingScopeUndoUnit.cs
- XmlWhitespace.cs
- LogicalMethodInfo.cs
- PinnedBufferMemoryStream.cs
- SerialReceived.cs
- SqlBooleanMismatchVisitor.cs
- ZoomPercentageConverter.cs
- DiscoveryEndpoint.cs
- PrintEvent.cs
- DataExchangeServiceBinder.cs
- SafeHandle.cs
- RelationshipManager.cs
- LinkTarget.cs
- DefaultValueTypeConverter.cs
- XmlAtomicValue.cs
- MetadataSerializer.cs
- RadioButtonStandardAdapter.cs
- X509CertificateClaimSet.cs
- SHA1Managed.cs
- Rights.cs
- DataGridViewCellParsingEventArgs.cs
- Color.cs
- NodeFunctions.cs
- ResolveMatchesMessageCD1.cs
- VScrollProperties.cs
- XmlSerializerAssemblyAttribute.cs
- UnsafeNativeMethods.cs
- XamlTemplateSerializer.cs
- Journaling.cs
- ProxyHwnd.cs
- MarkupCompilePass1.cs
- TemplateColumn.cs
- securitymgrsite.cs
- FormViewPageEventArgs.cs
- ConfigXmlElement.cs
- Wizard.cs
- CommandBindingCollection.cs
- ObjectToIdCache.cs
- MimeXmlImporter.cs
- XmlPreloadedResolver.cs
- SecondaryIndex.cs
- RegexMatchCollection.cs
- ExpressionBindingsDialog.cs
- WebResponse.cs
- FormClosingEvent.cs
- StateManagedCollection.cs
- ToolStripPanelSelectionGlyph.cs
- MemberRelationshipService.cs
- WebPartMenu.cs
- SystemSounds.cs
- MetaType.cs
- Panel.cs
- _TransmitFileOverlappedAsyncResult.cs
- ToolStripMenuItem.cs
- InputReport.cs
- DbFunctionCommandTree.cs
- BehaviorEditorPart.cs
- RectAnimationClockResource.cs
- DbParameterHelper.cs
- ErrorFormatterPage.cs
- IdentityNotMappedException.cs
- ToolZone.cs
- ItemCollection.cs
- PrintingPermissionAttribute.cs
- ConfigurationLockCollection.cs
- HWStack.cs
- ServicesUtilities.cs
- BulletChrome.cs