Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // 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; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PageThemeBuildProvider.cs
- EdmRelationshipRoleAttribute.cs
- Reference.cs
- LayoutEditorPart.cs
- SizeChangedInfo.cs
- WCFModelStrings.Designer.cs
- SpecularMaterial.cs
- SeverityFilter.cs
- QueryCursorEventArgs.cs
- ScriptIgnoreAttribute.cs
- DataBindEngine.cs
- ipaddressinformationcollection.cs
- CellPartitioner.cs
- SqlExpander.cs
- MsmqInputSessionChannel.cs
- ExtentJoinTreeNode.cs
- ExtentCqlBlock.cs
- OrderingQueryOperator.cs
- WebSysDescriptionAttribute.cs
- MimeObjectFactory.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- ResolveCriteria11.cs
- ComponentRenameEvent.cs
- MessagePropertyVariants.cs
- CryptoProvider.cs
- CqlErrorHelper.cs
- KeyTime.cs
- DiagnosticStrings.cs
- Resources.Designer.cs
- XamlPathDataSerializer.cs
- PropertyEmitter.cs
- StateValidator.cs
- PrintEvent.cs
- Utils.cs
- Int64Animation.cs
- FrameSecurityDescriptor.cs
- ImageFormatConverter.cs
- mactripleDES.cs
- CheckBoxList.cs
- EntityFunctions.cs
- ToolboxItem.cs
- StateRuntime.cs
- CryptoProvider.cs
- ValidationUtility.cs
- MultiAsyncResult.cs
- Menu.cs
- SqlMethodTransformer.cs
- Soap12ProtocolReflector.cs
- StaticDataManager.cs
- BatchWriter.cs
- RoleGroupCollection.cs
- PageStatePersister.cs
- WindowsPen.cs
- MetadataCollection.cs
- HwndMouseInputProvider.cs
- WhitespaceReader.cs
- CustomErrorCollection.cs
- GreenMethods.cs
- UserControl.cs
- NamespaceDisplay.xaml.cs
- Helper.cs
- AdapterUtil.cs
- RequestStatusBarUpdateEventArgs.cs
- PropertyManager.cs
- XmlNamespaceManager.cs
- CodeDomConfigurationHandler.cs
- SignatureToken.cs
- WindowsRichEditRange.cs
- ClientBuildManager.cs
- SeverityFilter.cs
- EmptyElement.cs
- TraceXPathNavigator.cs
- IResourceProvider.cs
- XmlNodeList.cs
- ButtonBase.cs
- DbDeleteCommandTree.cs
- NavigatorOutput.cs
- PenContext.cs
- StringPropertyBuilder.cs
- SystemIPInterfaceStatistics.cs
- TransportContext.cs
- BlurEffect.cs
- PostBackOptions.cs
- WebEncodingValidator.cs
- CaseExpr.cs
- FirstMatchCodeGroup.cs
- EUCJPEncoding.cs
- ComplexLine.cs
- ElementUtil.cs
- ControlCommandSet.cs
- LinqDataSourceStatusEventArgs.cs
- BamlTreeMap.cs
- BaseProcessProtocolHandler.cs
- TemplateModeChangedEventArgs.cs
- SerialStream.cs
- HtmlControlPersistable.cs
- DoWorkEventArgs.cs
- CornerRadius.cs
- ImageList.cs
- OleDbErrorCollection.cs