Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Util / SingleObjectCollection.cs / 1305376 / SingleObjectCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * SingleObjectCollection class * * Copyright (c) 1999 Microsoft Corporation */ namespace System.Web.Util { using System.Collections; /* * Fast implementation of a collection with a single object */ internal class SingleObjectCollection: ICollection { private class SingleObjectEnumerator: IEnumerator { private object _object; private bool done; public SingleObjectEnumerator(object o) { _object = o; } public object Current { get { return _object; } } public bool MoveNext() { if (!done) { done = true; return true; } return false; } public void Reset() { done = false; } } private object _object; public SingleObjectCollection(object o) { _object = o; } IEnumerator IEnumerable.GetEnumerator() { return new SingleObjectEnumerator(_object); } public int Count { get { return 1; } } bool ICollection.IsSynchronized { get { return true; } } object ICollection.SyncRoot { get { return this; } } public void CopyTo(Array array, int index) { array.SetValue(_object, index); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * SingleObjectCollection class * * Copyright (c) 1999 Microsoft Corporation */ namespace System.Web.Util { using System.Collections; /* * Fast implementation of a collection with a single object */ internal class SingleObjectCollection: ICollection { private class SingleObjectEnumerator: IEnumerator { private object _object; private bool done; public SingleObjectEnumerator(object o) { _object = o; } public object Current { get { return _object; } } public bool MoveNext() { if (!done) { done = true; return true; } return false; } public void Reset() { done = false; } } private object _object; public SingleObjectCollection(object o) { _object = o; } IEnumerator IEnumerable.GetEnumerator() { return new SingleObjectEnumerator(_object); } public int Count { get { return 1; } } bool ICollection.IsSynchronized { get { return true; } } object ICollection.SyncRoot { get { return this; } } public void CopyTo(Array array, int index) { array.SetValue(_object, index); } } } // 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
- CompilationRelaxations.cs
- SerialErrors.cs
- InstanceDataCollection.cs
- FunctionUpdateCommand.cs
- DriveNotFoundException.cs
- SettingsPropertyWrongTypeException.cs
- Rfc2898DeriveBytes.cs
- EncryptedType.cs
- base64Transforms.cs
- CodeSubDirectoriesCollection.cs
- HttpPostedFile.cs
- GlyphShapingProperties.cs
- StyleXamlTreeBuilder.cs
- DataGridRowEventArgs.cs
- XNodeValidator.cs
- _BasicClient.cs
- AttributedMetaModel.cs
- SaveFileDialog.cs
- IssuedTokenClientBehaviorsElementCollection.cs
- QueryContinueDragEvent.cs
- AutoScrollHelper.cs
- QuerySettings.cs
- ConditionValidator.cs
- DbParameterCollectionHelper.cs
- HwndSourceKeyboardInputSite.cs
- DesignerActionKeyboardBehavior.cs
- WebPartTracker.cs
- Base64Stream.cs
- ValidationResult.cs
- TextEvent.cs
- CroppedBitmap.cs
- CodeIdentifier.cs
- selecteditemcollection.cs
- DbMetaDataColumnNames.cs
- JoinGraph.cs
- MailMessageEventArgs.cs
- BaseProcessProtocolHandler.cs
- diagnosticsswitches.cs
- EntityStoreSchemaFilterEntry.cs
- SmiSettersStream.cs
- XmlnsDictionary.cs
- QuaternionAnimationUsingKeyFrames.cs
- SqlBuffer.cs
- HtmlSelect.cs
- HtmlControlPersistable.cs
- ToolStripMenuItem.cs
- CharConverter.cs
- prefixendpointaddressmessagefilter.cs
- Memoizer.cs
- ToolBar.cs
- RandomNumberGenerator.cs
- TextRunCacheImp.cs
- UpdatePanel.cs
- ObjectComplexPropertyMapping.cs
- BindableAttribute.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- CodeMethodInvokeExpression.cs
- X509ChainElement.cs
- UICuesEvent.cs
- RegexWriter.cs
- NodeInfo.cs
- FontFamilyIdentifier.cs
- TreePrinter.cs
- RewritingPass.cs
- odbcmetadatacolumnnames.cs
- FileVersion.cs
- XmlSchemaGroup.cs
- EntityDataSourceWizardForm.cs
- FrameworkReadOnlyPropertyMetadata.cs
- PeerResolverElement.cs
- TableAutomationPeer.cs
- QuestionEventArgs.cs
- X509PeerCertificateAuthentication.cs
- XmlTextWriter.cs
- PrintPreviewDialog.cs
- ButtonColumn.cs
- BufferBuilder.cs
- WinFormsComponentEditor.cs
- ClassDataContract.cs
- WindowCollection.cs
- DeferredReference.cs
- DataSourceHelper.cs
- Wizard.cs
- StructuralObject.cs
- DialogResultConverter.cs
- BindingGroup.cs
- DbConnectionPoolOptions.cs
- SamlSubject.cs
- PrivacyNoticeBindingElementImporter.cs
- Automation.cs
- DataGridViewHitTestInfo.cs
- GatewayDefinition.cs
- AtomPub10CategoriesDocumentFormatter.cs
- XPathBinder.cs
- DTCTransactionManager.cs
- UrlMappingsSection.cs
- DataGridViewCellCollection.cs
- ColorIndependentAnimationStorage.cs
- KeyTime.cs
- WhitespaceRule.cs