Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SystemUnicastIPAddressInformation.cs
- TreeNodeMouseHoverEvent.cs
- WindowsIdentity.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- LinqDataSource.cs
- InternalConfigSettingsFactory.cs
- WorkflowMarkupSerializationManager.cs
- FixedSOMTextRun.cs
- Matrix.cs
- WindowsFormsHostAutomationPeer.cs
- HttpInputStream.cs
- ErrorsHelper.cs
- ControlValuePropertyAttribute.cs
- DockPatternIdentifiers.cs
- PrintingPermission.cs
- ProtectedConfiguration.cs
- CngAlgorithm.cs
- Exceptions.cs
- HttpListenerResponse.cs
- FormatterServices.cs
- InputScopeConverter.cs
- BackgroundWorker.cs
- SchemaImporterExtensionElement.cs
- CollectionConverter.cs
- MultiAsyncResult.cs
- _TimerThread.cs
- CustomLineCap.cs
- Parser.cs
- ApplicationCommands.cs
- UshortList2.cs
- CacheOutputQuery.cs
- MembershipSection.cs
- IncrementalReadDecoders.cs
- TabRenderer.cs
- RestHandler.cs
- StorageSetMapping.cs
- WsatServiceAddress.cs
- FlowchartSizeFeature.cs
- IndicCharClassifier.cs
- ExpressionEvaluator.cs
- AsyncResult.cs
- ModelTreeEnumerator.cs
- StringUtil.cs
- UInt16Converter.cs
- EpmContentDeSerializer.cs
- EntityDataSourceDesignerHelper.cs
- ProfileParameter.cs
- FullTextLine.cs
- Win32.cs
- UdpTransportSettingsElement.cs
- Visitor.cs
- DbProviderManifest.cs
- ThemeableAttribute.cs
- ConfigViewGenerator.cs
- EditorZone.cs
- DateTimeFormat.cs
- PassportPrincipal.cs
- PermissionAttributes.cs
- WindowCollection.cs
- SoapExtension.cs
- ReadingWritingEntityEventArgs.cs
- AuthStoreRoleProvider.cs
- SharedRuntimeState.cs
- GrammarBuilderDictation.cs
- ColorDialog.cs
- UriTemplateMatch.cs
- DocumentSchemaValidator.cs
- SerializableReadOnlyDictionary.cs
- MultipartContentParser.cs
- BitmapData.cs
- DoubleIndependentAnimationStorage.cs
- CancellationHandlerDesigner.cs
- DataGridViewCellCollection.cs
- ImageUrlEditor.cs
- QilExpression.cs
- TrustLevel.cs
- AbstractSvcMapFileLoader.cs
- KeyTimeConverter.cs
- StringSorter.cs
- DescriptionAttribute.cs
- BaseCAMarshaler.cs
- InputProviderSite.cs
- EditorPartCollection.cs
- UInt32Storage.cs
- Subset.cs
- ArgumentsParser.cs
- WebPageTraceListener.cs
- SqlProviderManifest.cs
- DataGridViewAutoSizeModeEventArgs.cs
- Util.cs
- TextBoxView.cs
- MarkupCompilePass2.cs
- PathSegmentCollection.cs
- HwndStylusInputProvider.cs
- WebPartTracker.cs
- _CookieModule.cs
- ExternalFile.cs
- ScriptComponentDescriptor.cs
- ObjectItemCachedAssemblyLoader.cs
- ExpressionNormalizer.cs