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
- XmlSerializer.cs
- ErrorHandler.cs
- EmbeddedMailObjectsCollection.cs
- CollectionViewProxy.cs
- DesignerCategoryAttribute.cs
- WaitHandle.cs
- TokenizerHelper.cs
- AgileSafeNativeMemoryHandle.cs
- TextEditorLists.cs
- XmlChoiceIdentifierAttribute.cs
- GetWinFXPath.cs
- CompensationDesigner.cs
- MarkupCompilePass2.cs
- StopRoutingHandler.cs
- RuleConditionDialog.cs
- SerializationFieldInfo.cs
- RsaSecurityTokenAuthenticator.cs
- EdmMember.cs
- AsymmetricSignatureDeformatter.cs
- ResourceBinder.cs
- TemplateControlParser.cs
- RuntimeCompatibilityAttribute.cs
- SymbolEqualComparer.cs
- EntityDataSourceWrapperCollection.cs
- ApplicationGesture.cs
- ComboBoxDesigner.cs
- AdapterUtil.cs
- ListSortDescription.cs
- LassoSelectionBehavior.cs
- XmlAnyAttributeAttribute.cs
- HwndProxyElementProvider.cs
- DbProviderSpecificTypePropertyAttribute.cs
- Hashtable.cs
- ProfileModule.cs
- WorkflowViewManager.cs
- IdentifierCreationService.cs
- HandoffBehavior.cs
- StringResourceManager.cs
- AvTraceFormat.cs
- ToolStripSeparator.cs
- ActivityCodeDomSerializer.cs
- SqlInternalConnection.cs
- WasAdminWrapper.cs
- QueryResults.cs
- IPipelineRuntime.cs
- DataRelation.cs
- PropertyBuilder.cs
- DragDrop.cs
- Cell.cs
- RequestUriProcessor.cs
- XmlAutoDetectWriter.cs
- localization.cs
- SoapParser.cs
- ListDictionaryInternal.cs
- DataGridViewRowsRemovedEventArgs.cs
- WindowVisualStateTracker.cs
- ObjectContextServiceProvider.cs
- DynamicResourceExtension.cs
- QilSortKey.cs
- DeclarativeCatalogPart.cs
- PathFigureCollection.cs
- HtmlShimManager.cs
- WorkflowRuntimeBehavior.cs
- ValidationHelpers.cs
- PolyLineSegment.cs
- DiscardableAttribute.cs
- DropShadowBitmapEffect.cs
- CacheMode.cs
- WindowsEditBox.cs
- Roles.cs
- SubMenuStyleCollection.cs
- MessagePropertyFilter.cs
- DeclarativeExpressionConditionDeclaration.cs
- RadioButtonFlatAdapter.cs
- CultureMapper.cs
- ObjectSet.cs
- SessionStateUtil.cs
- CodeDirectoryCompiler.cs
- SectionVisual.cs
- Brush.cs
- PointLight.cs
- DriveInfo.cs
- ResetableIterator.cs
- SafeSystemMetrics.cs
- TableLayoutRowStyleCollection.cs
- DeleteStoreRequest.cs
- DataError.cs
- ReadOnlyHierarchicalDataSource.cs
- Main.cs
- GridView.cs
- DispatcherOperation.cs
- MultiSelectRootGridEntry.cs
- _Connection.cs
- BindingCompleteEventArgs.cs
- AddInStore.cs
- XhtmlBasicCommandAdapter.cs
- State.cs
- GeneralTransform.cs
- DataGridDesigner.cs
- handlecollector.cs