Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- DebuggerAttributes.cs
- TextEditorContextMenu.cs
- Globals.cs
- InvalidWMPVersionException.cs
- SessionPageStateSection.cs
- ListChangedEventArgs.cs
- Positioning.cs
- StateChangeEvent.cs
- ConnectionStringsExpressionEditor.cs
- SerialPinChanges.cs
- CodeComment.cs
- SQLDecimal.cs
- PageOrientation.cs
- GridToolTip.cs
- ResolveDuplex11AsyncResult.cs
- OleDbCommandBuilder.cs
- AVElementHelper.cs
- Blend.cs
- VisualCollection.cs
- HyperLinkField.cs
- SafeProcessHandle.cs
- SmiEventSink.cs
- SafeEventLogWriteHandle.cs
- DecoderReplacementFallback.cs
- PrintController.cs
- FlowLayoutSettings.cs
- HMACSHA512.cs
- SqlPersonalizationProvider.cs
- DataGridTablesFactory.cs
- MeasurementDCInfo.cs
- RotateTransform.cs
- NonBatchDirectoryCompiler.cs
- DomainConstraint.cs
- CodeRegionDirective.cs
- EncoderParameter.cs
- RefType.cs
- TextBoxBase.cs
- SrgsText.cs
- Instrumentation.cs
- ReadOnlyPermissionSet.cs
- SerializationAttributes.cs
- DataGridViewCellValidatingEventArgs.cs
- MaterialCollection.cs
- HotSpotCollection.cs
- WindowsRichEditRange.cs
- safex509handles.cs
- SkinBuilder.cs
- ReadOnlyObservableCollection.cs
- XPathPatternBuilder.cs
- HwndMouseInputProvider.cs
- DataGridItemCollection.cs
- Int32Collection.cs
- QueryResponse.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- ToolboxItemCollection.cs
- ModulesEntry.cs
- EncryptedPackage.cs
- ControlTemplate.cs
- AutoScrollExpandMessageFilter.cs
- AspNetHostingPermission.cs
- PauseStoryboard.cs
- MouseActionConverter.cs
- FixedDocumentPaginator.cs
- CodeMemberField.cs
- DataTemplateKey.cs
- HttpWebRequest.cs
- SortAction.cs
- PermissionRequestEvidence.cs
- FigureParaClient.cs
- PageAsyncTask.cs
- RuleConditionDialog.Designer.cs
- MarkupCompilePass2.cs
- SettingsProviderCollection.cs
- ColorComboBox.cs
- AlternateViewCollection.cs
- DebugInfoExpression.cs
- HttpAsyncResult.cs
- AssertSection.cs
- SmtpReplyReader.cs
- HelpKeywordAttribute.cs
- CellConstantDomain.cs
- ScriptHandlerFactory.cs
- SecurityCapabilities.cs
- TripleDESCryptoServiceProvider.cs
- PauseStoryboard.cs
- BigInt.cs
- UriWriter.cs
- SystemDropShadowChrome.cs
- InputLanguage.cs
- ContainerSelectorBehavior.cs
- PathFigure.cs
- GradientStop.cs
- DateTimeValueSerializerContext.cs
- _NestedSingleAsyncResult.cs
- SvcMapFile.cs
- ProviderIncompatibleException.cs
- RC2CryptoServiceProvider.cs
- _AcceptOverlappedAsyncResult.cs
- SystemUnicastIPAddressInformation.cs
- DatagridviewDisplayedBandsData.cs