Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UpWmlPageAdapter.cs
- connectionpool.cs
- PropertyToken.cs
- PolicyStatement.cs
- ClientType.cs
- ReverseInheritProperty.cs
- MetadataItemCollectionFactory.cs
- SecurityPolicySection.cs
- Types.cs
- DataRowView.cs
- FreeIndexList.cs
- MetricEntry.cs
- FolderLevelBuildProviderCollection.cs
- XmlDataSourceView.cs
- SyndicationFeed.cs
- DefaultAssemblyResolver.cs
- GetPolicyDetailsRequest.cs
- SMSvcHost.cs
- NotifyIcon.cs
- CheckBoxRenderer.cs
- CommonXSendMessage.cs
- HttpWebResponse.cs
- ParenExpr.cs
- MailDefinition.cs
- ADMembershipUser.cs
- AxHostDesigner.cs
- EventHandlersDesigner.cs
- RowToParametersTransformer.cs
- GeneralTransform.cs
- StorageEntityTypeMapping.cs
- BitStream.cs
- SqlFactory.cs
- DateTimeOffset.cs
- HttpAsyncResult.cs
- NaturalLanguageHyphenator.cs
- Trace.cs
- Native.cs
- Fx.cs
- Selector.cs
- WebPartConnectionsCancelEventArgs.cs
- BrowserCapabilitiesFactoryBase.cs
- SynchronizedChannelCollection.cs
- XNodeValidator.cs
- ResourceDictionary.cs
- BamlWriter.cs
- ListDictionary.cs
- TemplateInstanceAttribute.cs
- SystemFonts.cs
- RoutedPropertyChangedEventArgs.cs
- EditorPartCollection.cs
- Nodes.cs
- ShellProvider.cs
- FormView.cs
- DesignSurfaceEvent.cs
- QilPatternVisitor.cs
- SegmentTree.cs
- NonParentingControl.cs
- XmlSignificantWhitespace.cs
- Int64Storage.cs
- XmlSchemaCollection.cs
- XmlEncoding.cs
- SqlServer2KCompatibilityCheck.cs
- TagPrefixInfo.cs
- EnumMemberAttribute.cs
- DefaultTextStore.cs
- GZipDecoder.cs
- DeploymentSectionCache.cs
- PageBorderless.cs
- XmlILConstructAnalyzer.cs
- StopStoryboard.cs
- MarkupProperty.cs
- Transform.cs
- ReadWriteObjectLock.cs
- ConvertersCollection.cs
- SecurityException.cs
- TiffBitmapDecoder.cs
- HostVisual.cs
- CompressionTransform.cs
- ValidationErrorCollection.cs
- _SingleItemRequestCache.cs
- ConfigurationElement.cs
- MemberHolder.cs
- CryptographicAttribute.cs
- ApplicationDirectory.cs
- TdsParserSafeHandles.cs
- DataKey.cs
- Point3DConverter.cs
- DataGridViewRowPrePaintEventArgs.cs
- RelationshipManager.cs
- ConcurrentDictionary.cs
- HelpHtmlBuilder.cs
- DataGridToolTip.cs
- DataGridTextBoxColumn.cs
- CdpEqualityComparer.cs
- XmlSerializerObjectSerializer.cs
- MDIControlStrip.cs
- XmlDataLoader.cs
- FontFamilyConverter.cs
- xmlglyphRunInfo.cs
- AssemblyNameEqualityComparer.cs