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
- AnimationClockResource.cs
- DataGridAddNewRow.cs
- BaseParser.cs
- SQLSingleStorage.cs
- RepeaterCommandEventArgs.cs
- TextBlockAutomationPeer.cs
- ViewBox.cs
- UnsafeNativeMethodsTablet.cs
- DataTableCollection.cs
- ToolStripEditorManager.cs
- AsyncOperationManager.cs
- SystemInfo.cs
- ScrollChangedEventArgs.cs
- ThreadStartException.cs
- AuthenticateEventArgs.cs
- TableLayoutSettingsTypeConverter.cs
- OdbcParameter.cs
- SecurityUtils.cs
- Compensation.cs
- CfgRule.cs
- SetStoryboardSpeedRatio.cs
- DataBindingValueUIHandler.cs
- InputBinding.cs
- odbcmetadatacolumnnames.cs
- SiteMembershipCondition.cs
- XslException.cs
- AutomationPatternInfo.cs
- ToolboxCategoryItems.cs
- HtmlInputButton.cs
- Normalization.cs
- HtmlEmptyTagControlBuilder.cs
- UIElementHelper.cs
- XPathDescendantIterator.cs
- SecurityKeyIdentifier.cs
- CompModSwitches.cs
- Tuple.cs
- ByteStreamMessageUtility.cs
- ClientReliableChannelBinder.cs
- HwndHostAutomationPeer.cs
- DesignerDataView.cs
- ScriptReference.cs
- LostFocusEventManager.cs
- COSERVERINFO.cs
- SecurityPolicySection.cs
- httpserverutility.cs
- PersistencePipeline.cs
- InstanceView.cs
- _NestedMultipleAsyncResult.cs
- _Events.cs
- IsolatedStorageFile.cs
- MarshalByRefObject.cs
- FileUpload.cs
- TitleStyle.cs
- GridSplitter.cs
- PresentationTraceSources.cs
- PeerNameRecordCollection.cs
- XmlWriterTraceListener.cs
- DataTableReaderListener.cs
- LinqDataSourceStatusEventArgs.cs
- ColorTransformHelper.cs
- iisPickupDirectory.cs
- HyperLinkField.cs
- BitmapImage.cs
- EntityDataSourceStatementEditor.cs
- SQLChars.cs
- ApplicationException.cs
- IRCollection.cs
- RequestTimeoutManager.cs
- NameValuePermission.cs
- DatePickerTextBox.cs
- ObjectStateManager.cs
- EncoderParameter.cs
- SessionStateUtil.cs
- TemplateParser.cs
- CrossContextChannel.cs
- ToolboxItemFilterAttribute.cs
- StylusPointPropertyInfo.cs
- TextDecorations.cs
- PhonemeConverter.cs
- ExtensionCollection.cs
- SHA512.cs
- RuleAttributes.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- IndexOutOfRangeException.cs
- ClrPerspective.cs
- TreeNodeBindingCollection.cs
- _ConnectionGroup.cs
- Types.cs
- TargetControlTypeAttribute.cs
- Itemizer.cs
- ProxyWebPartManager.cs
- CharEntityEncoderFallback.cs
- LocatorPartList.cs
- BooleanFunctions.cs
- ControlBuilder.cs
- WindowsFormsHost.cs
- SQLMembershipProvider.cs
- MetadataPropertyAttribute.cs
- CompiledRegexRunnerFactory.cs
- DataGridViewComboBoxCell.cs