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
- ServiceDescriptionSerializer.cs
- ConfigurationSettings.cs
- SkipStoryboardToFill.cs
- OdbcConnection.cs
- IPPacketInformation.cs
- BoundPropertyEntry.cs
- TraceSwitch.cs
- TransportContext.cs
- PixelFormats.cs
- DataGridViewSortCompareEventArgs.cs
- StringUtil.cs
- GifBitmapDecoder.cs
- dbenumerator.cs
- TcpConnectionPool.cs
- ObjectStateFormatter.cs
- ColorPalette.cs
- LinearGradientBrush.cs
- RuntimeHandles.cs
- RadioButtonBaseAdapter.cs
- CompilationLock.cs
- RawStylusInputReport.cs
- ContextProperty.cs
- RC2.cs
- JsonSerializer.cs
- XsdBuilder.cs
- InvalidEnumArgumentException.cs
- BreakRecordTable.cs
- DependencyProperty.cs
- DesignRelation.cs
- BevelBitmapEffect.cs
- _OSSOCK.cs
- FlowLayoutPanel.cs
- WebSysDescriptionAttribute.cs
- DetailsViewCommandEventArgs.cs
- XmlObjectSerializerWriteContextComplex.cs
- COMException.cs
- ClientSettings.cs
- CacheEntry.cs
- MultipleViewProviderWrapper.cs
- RemoveStoryboard.cs
- InvalidWorkflowException.cs
- Tokenizer.cs
- BitmapEffectDrawing.cs
- DecoderFallback.cs
- CompositeActivityDesigner.cs
- TargetConverter.cs
- GeneratedCodeAttribute.cs
- LinkDescriptor.cs
- SplashScreen.cs
- KeyValuePair.cs
- WSHttpTransportSecurityElement.cs
- DatePickerTextBox.cs
- InstanceHandleReference.cs
- SqlDependency.cs
- EventDescriptor.cs
- VisualBrush.cs
- KeySpline.cs
- StorageAssociationTypeMapping.cs
- ExpressionConverter.cs
- CqlQuery.cs
- SharedUtils.cs
- MatrixTransform3D.cs
- StreamWriter.cs
- StylusOverProperty.cs
- SignatureGenerator.cs
- XPathBuilder.cs
- DBPropSet.cs
- GB18030Encoding.cs
- ConnectionManagementSection.cs
- PublisherMembershipCondition.cs
- HideDisabledControlAdapter.cs
- SessionIDManager.cs
- PriorityRange.cs
- ImportCatalogPart.cs
- MatchAttribute.cs
- HtmlLabelAdapter.cs
- AdapterUtil.cs
- TextTreeInsertElementUndoUnit.cs
- AppDomain.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- DebugView.cs
- MeasureData.cs
- OleDbEnumerator.cs
- ToolStripDropDownMenu.cs
- Content.cs
- DataRelation.cs
- OAVariantLib.cs
- InvalidComObjectException.cs
- Win32SafeHandles.cs
- BaseTemplateParser.cs
- QilSortKey.cs
- BamlLocalizableResource.cs
- DataStorage.cs
- SchemaEntity.cs
- OraclePermissionAttribute.cs
- CompiledRegexRunnerFactory.cs
- ToolStripContainer.cs
- XmlLanguageConverter.cs
- RuntimeHelpers.cs
- EnvelopedPkcs7.cs