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
- TemplateField.cs
- LinkLabelLinkClickedEvent.cs
- DataObjectFieldAttribute.cs
- IChannel.cs
- DateTimeConstantAttribute.cs
- EncoderExceptionFallback.cs
- PolygonHotSpot.cs
- Rectangle.cs
- ArrayElementGridEntry.cs
- TextTreeExtractElementUndoUnit.cs
- XmlElementAttribute.cs
- MediaEntryAttribute.cs
- ConfigsHelper.cs
- ScalarType.cs
- WebUtil.cs
- SoapExtensionReflector.cs
- HtmlControlPersistable.cs
- SplitterPanel.cs
- CodeExpressionStatement.cs
- UndoEngine.cs
- ServicePointManagerElement.cs
- Html32TextWriter.cs
- TouchesCapturedWithinProperty.cs
- IndexerNameAttribute.cs
- Cloud.cs
- SevenBitStream.cs
- ProvidersHelper.cs
- Transactions.cs
- MinMaxParagraphWidth.cs
- OdbcDataAdapter.cs
- TemplateColumn.cs
- SqlNode.cs
- FileRecordSequenceCompletedAsyncResult.cs
- ConfigurationSectionCollection.cs
- IDispatchConstantAttribute.cs
- _CacheStreams.cs
- Visitor.cs
- DocumentSequenceHighlightLayer.cs
- DbConnectionPoolGroupProviderInfo.cs
- NamedPipeProcessProtocolHandler.cs
- EditingMode.cs
- ConfigXmlAttribute.cs
- FileRecordSequenceHelper.cs
- FileSystemWatcher.cs
- BooleanFacetDescriptionElement.cs
- ContravarianceAdapter.cs
- XmlAnyAttributeAttribute.cs
- SingleSelectRootGridEntry.cs
- ThreadPool.cs
- DataSourceNameHandler.cs
- WithParamAction.cs
- FaultHandlingFilter.cs
- BitmapCodecInfoInternal.cs
- PolicyLevel.cs
- WebScriptMetadataInstanceContextProvider.cs
- Int32RectConverter.cs
- DodSequenceMerge.cs
- followingquery.cs
- MessagePropertyVariants.cs
- OdbcConnectionOpen.cs
- SymLanguageVendor.cs
- PagedControl.cs
- Adorner.cs
- TextStore.cs
- securitycriticaldata.cs
- SrgsRule.cs
- jithelpers.cs
- TextEditorSpelling.cs
- LocatorGroup.cs
- AdPostCacheSubstitution.cs
- _UriTypeConverter.cs
- FontSizeConverter.cs
- InfoCardBaseException.cs
- TimelineGroup.cs
- ContainerParagraph.cs
- SchemaImporter.cs
- DefaultSerializationProviderAttribute.cs
- ReceiveActivity.cs
- Ray3DHitTestResult.cs
- BinaryFormatter.cs
- GenericUI.cs
- SqlDependencyListener.cs
- BinaryCommonClasses.cs
- PTUtility.cs
- Thread.cs
- PrivateFontCollection.cs
- TriggerBase.cs
- ViewBox.cs
- TypeListConverter.cs
- GeometryCombineModeValidation.cs
- HotCommands.cs
- DataGridColumnDropSeparator.cs
- VectorConverter.cs
- Atom10FeedFormatter.cs
- XamlSerializerUtil.cs
- IQueryable.cs
- SortDescription.cs
- RIPEMD160.cs
- WindowExtensionMethods.cs
- StandardCommands.cs