Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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. // // ==--== /*============================================================ ** ** 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ping.cs
- HitTestParameters.cs
- TemplateField.cs
- TransactionFlowAttribute.cs
- BitmapImage.cs
- FigureParaClient.cs
- XPathDocument.cs
- ToolBarButton.cs
- StructuredType.cs
- XmlCharCheckingReader.cs
- CustomValidator.cs
- DelegateOutArgument.cs
- VisualTransition.cs
- WizardPanel.cs
- ContentValidator.cs
- PackageDigitalSignatureManager.cs
- SmtpSection.cs
- TraceRecords.cs
- webeventbuffer.cs
- Style.cs
- DataSourceCacheDurationConverter.cs
- XPathAncestorIterator.cs
- DataGridViewBand.cs
- SynchronizingStream.cs
- DefaultAssemblyResolver.cs
- DrawingVisualDrawingContext.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- SQLDouble.cs
- ping.cs
- _HeaderInfoTable.cs
- PageRequestManager.cs
- ExistsInCollection.cs
- TypedDataSetSchemaImporterExtension.cs
- WebPartDisplayMode.cs
- Trigger.cs
- PeerPresenceInfo.cs
- DataSet.cs
- SelectionWordBreaker.cs
- TreeNodeClickEventArgs.cs
- CodeArrayCreateExpression.cs
- Stopwatch.cs
- SortKey.cs
- WorkflowInstance.cs
- Message.cs
- CellQuery.cs
- MetadataItem_Static.cs
- TimeSpanValidatorAttribute.cs
- ISAPIWorkerRequest.cs
- FontWeightConverter.cs
- TextComposition.cs
- ObjectSelectorEditor.cs
- brushes.cs
- baseaxisquery.cs
- ConnectionStringsExpressionBuilder.cs
- BamlRecordHelper.cs
- DocumentSchemaValidator.cs
- GeometryGroup.cs
- Privilege.cs
- BaseCodePageEncoding.cs
- SecurityUtils.cs
- ScanQueryOperator.cs
- SqlRowUpdatedEvent.cs
- EmptyEnumerable.cs
- AggregationMinMaxHelpers.cs
- NetworkInformationException.cs
- AudioException.cs
- SslStream.cs
- TemplateBindingExtensionConverter.cs
- XmlDataDocument.cs
- List.cs
- MethodAccessException.cs
- MappedMetaModel.cs
- TimeEnumHelper.cs
- ProxyHelper.cs
- GPRECT.cs
- ParenExpr.cs
- DataTableMapping.cs
- MaterializeFromAtom.cs
- commandenforcer.cs
- Permission.cs
- NameObjectCollectionBase.cs
- RectAnimation.cs
- TableLayout.cs
- PageClientProxyGenerator.cs
- NamedPipeTransportManager.cs
- CatalogZoneAutoFormat.cs
- RightsManagementEncryptionTransform.cs
- SqlInternalConnection.cs
- EntityDataReader.cs
- SelectorAutomationPeer.cs
- PropertyItem.cs
- Attribute.cs
- SqlProviderServices.cs
- MeasureItemEvent.cs
- DataSourceControlBuilder.cs
- TypeSystem.cs
- AlignmentXValidation.cs
- MultiSelectRootGridEntry.cs
- NamespaceInfo.cs
- SafeTimerHandle.cs