Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / CharEnumerator.cs / 1305376 / 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; using System.Diagnostics.Contracts; [System.Runtime.InteropServices.ComVisible(true)] [Serializable] public sealed class CharEnumerator : IEnumerator, ICloneable, IEnumerator, IDisposable { private String str; private int index; private char currentElement; internal CharEnumerator(String str) { Contract.Requires(str != null); this.str = str; this.index = -1; } [System.Security.SecuritySafeCritical] // auto-generated 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; } public void Dispose() { if (str != null) index = str.Length; str = null; } /// 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; using System.Diagnostics.Contracts; [System.Runtime.InteropServices.ComVisible(true)] [Serializable] public sealed class CharEnumerator : IEnumerator, ICloneable, IEnumerator , IDisposable { private String str; private int index; private char currentElement; internal CharEnumerator(String str) { Contract.Requires(str != null); this.str = str; this.index = -1; } [System.Security.SecuritySafeCritical] // auto-generated 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; } public void Dispose() { if (str != null) index = str.Length; str = null; } /// 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
- PanelDesigner.cs
- InvokeHandlers.cs
- NavigationService.cs
- SecurityTokenResolver.cs
- TypeReference.cs
- EventListenerClientSide.cs
- AssemblyResourceLoader.cs
- BooleanExpr.cs
- InputScopeManager.cs
- EntityContainerEmitter.cs
- XamlSerializationHelper.cs
- TrackingDataItem.cs
- FontUnit.cs
- SmiEventSink_Default.cs
- oledbmetadatacollectionnames.cs
- _DisconnectOverlappedAsyncResult.cs
- ContainsRowNumberChecker.cs
- ParenthesizePropertyNameAttribute.cs
- TextUtf8RawTextWriter.cs
- PageBorderless.cs
- ThreadLocal.cs
- ScrollChangedEventArgs.cs
- ArraySortHelper.cs
- MeasureData.cs
- HtmlTextBoxAdapter.cs
- HTTPAPI_VERSION.cs
- DisplayMemberTemplateSelector.cs
- GroupAggregateExpr.cs
- XslNumber.cs
- EraserBehavior.cs
- PhotoPrintingIntent.cs
- WorkflowFileItem.cs
- IncomingWebRequestContext.cs
- COAUTHIDENTITY.cs
- AddressAccessDeniedException.cs
- EncoderReplacementFallback.cs
- BoundColumn.cs
- ItemCollection.cs
- OleDbPropertySetGuid.cs
- EdmError.cs
- ExpressionEditorAttribute.cs
- XmlDataCollection.cs
- EntityDataSourceQueryBuilder.cs
- EmbossBitmapEffect.cs
- PropertyEmitter.cs
- RecognizedWordUnit.cs
- KeyProperty.cs
- DictionarySectionHandler.cs
- FormViewUpdateEventArgs.cs
- mil_sdk_version.cs
- FontStyle.cs
- InkCanvas.cs
- AsynchronousChannelMergeEnumerator.cs
- KeyInfo.cs
- CompensationHandlingFilter.cs
- AlignmentYValidation.cs
- SiteMapPath.cs
- HttpMethodConstraint.cs
- Stack.cs
- CanonicalXml.cs
- StreamSecurityUpgradeInitiatorBase.cs
- _ListenerAsyncResult.cs
- HTMLTextWriter.cs
- SemanticTag.cs
- ReliableReplySessionChannel.cs
- CodeVariableDeclarationStatement.cs
- AsymmetricSignatureDeformatter.cs
- GlyphTypeface.cs
- OrderedDictionary.cs
- basevalidator.cs
- EntityUtil.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- RootBrowserWindowAutomationPeer.cs
- InputScopeNameConverter.cs
- LazyTextWriterCreator.cs
- Hex.cs
- CharEntityEncoderFallback.cs
- ModuleBuilder.cs
- RadioButtonPopupAdapter.cs
- TouchEventArgs.cs
- x509utils.cs
- CodeTypeMemberCollection.cs
- ToggleProviderWrapper.cs
- WebBrowserPermission.cs
- XmlRootAttribute.cs
- MarshalByValueComponent.cs
- OleDbConnection.cs
- BoolExpressionVisitors.cs
- DbSetClause.cs
- SmiEventSink_Default.cs
- CodeConditionStatement.cs
- SubpageParaClient.cs
- HttpHandlersSection.cs
- ExternalFile.cs
- CounterSetInstanceCounterDataSet.cs
- OleDbWrapper.cs
- FatalException.cs
- ListViewEditEventArgs.cs
- EmptyCollection.cs
- DataBoundControlAdapter.cs