Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / xsp / System / Web / Util / SingleObjectCollection.cs / 1 / 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
- TabPage.cs
- ConstructorArgumentAttribute.cs
- DataGridColumnHeaderCollection.cs
- RunInstallerAttribute.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- KeyFrames.cs
- WebPartConnectionsEventArgs.cs
- ImagingCache.cs
- DataKeyCollection.cs
- X509IssuerSerialKeyIdentifierClause.cs
- FtpCachePolicyElement.cs
- CodeIdentifier.cs
- ProgressBarBrushConverter.cs
- ToolStripDesignerUtils.cs
- RequestCacheValidator.cs
- BinaryWriter.cs
- ViewGenerator.cs
- EntityFrameworkVersions.cs
- Model3D.cs
- ResourceContainer.cs
- WmpBitmapDecoder.cs
- DecimalConverter.cs
- TokenBasedSetEnumerator.cs
- BinaryMethodMessage.cs
- WindowsEditBox.cs
- EncoderExceptionFallback.cs
- AdapterDictionary.cs
- _UncName.cs
- BufferedGraphicsManager.cs
- StatusStrip.cs
- NamedPermissionSet.cs
- InputMethod.cs
- AmbientProperties.cs
- AdRotator.cs
- RuntimeConfigLKG.cs
- RowUpdatedEventArgs.cs
- SqlTriggerAttribute.cs
- ProgressBarBrushConverter.cs
- RijndaelManagedTransform.cs
- _KerberosClient.cs
- GeneralTransform3D.cs
- ToolStripMenuItemDesigner.cs
- ManipulationCompletedEventArgs.cs
- PersistenceProviderBehavior.cs
- Vector3DAnimationBase.cs
- TimeStampChecker.cs
- TimerElapsedEvenArgs.cs
- StrongNameUtility.cs
- StoreContentChangedEventArgs.cs
- RuleSetReference.cs
- Double.cs
- ZipIOLocalFileBlock.cs
- HyperLinkDesigner.cs
- ThreadExceptionDialog.cs
- ProfilePropertyNameValidator.cs
- XmlElement.cs
- SplashScreenNativeMethods.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- EncryptedReference.cs
- SynchronizedCollection.cs
- ADMembershipUser.cs
- AttributeQuery.cs
- XmlKeywords.cs
- DateTime.cs
- ApplicationSecurityManager.cs
- HostProtectionPermission.cs
- GC.cs
- IdentityNotMappedException.cs
- DesignerWidgets.cs
- FontFamilyIdentifier.cs
- CatalogPartCollection.cs
- SafeRightsManagementPubHandle.cs
- XmlDataImplementation.cs
- _NestedSingleAsyncResult.cs
- mansign.cs
- DayRenderEvent.cs
- ListViewGroupItemCollection.cs
- FormsAuthenticationCredentials.cs
- GraphicsPath.cs
- WebPartDescription.cs
- PageTheme.cs
- RootDesignerSerializerAttribute.cs
- IntellisenseTextBox.cs
- ManipulationStartingEventArgs.cs
- AdornerPresentationContext.cs
- FormViewDesigner.cs
- CfgArc.cs
- CheckBoxList.cs
- QuaternionKeyFrameCollection.cs
- Error.cs
- HtmlInputReset.cs
- GorillaCodec.cs
- XPathChildIterator.cs
- VisualTarget.cs
- Slider.cs
- EtwProvider.cs
- AssemblyResourceLoader.cs
- ExtendedProtectionPolicyElement.cs
- NullableDecimalSumAggregationOperator.cs
- UITypeEditors.cs