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
- ScriptingProfileServiceSection.cs
- AQNBuilder.cs
- CustomCategoryAttribute.cs
- CodePropertyReferenceExpression.cs
- DesignerObject.cs
- SecurityManager.cs
- EditorZoneBase.cs
- SatelliteContractVersionAttribute.cs
- CharEnumerator.cs
- Size.cs
- SerialStream.cs
- Rect.cs
- UnsafeCollabNativeMethods.cs
- FixedSOMElement.cs
- RbTree.cs
- TextControl.cs
- TypeUsageBuilder.cs
- _WinHttpWebProxyDataBuilder.cs
- PixelFormatConverter.cs
- Error.cs
- PageStatePersister.cs
- ToolStripPanelRenderEventArgs.cs
- BooleanAnimationBase.cs
- DbDataSourceEnumerator.cs
- Base64Encoding.cs
- SerialErrors.cs
- TransactionManager.cs
- ResourceManager.cs
- DesignParameter.cs
- OleDbDataReader.cs
- SelectionService.cs
- parserscommon.cs
- SafeNativeMethods.cs
- IndexedDataBuffer.cs
- ProfilePropertyMetadata.cs
- Funcletizer.cs
- Durable.cs
- RijndaelManagedTransform.cs
- TextRangeProviderWrapper.cs
- XmlSchemaSet.cs
- SizeF.cs
- TreeNodeClickEventArgs.cs
- SecUtil.cs
- XmlSchemaInfo.cs
- ImmutableObjectAttribute.cs
- Int32Rect.cs
- FixedSOMTable.cs
- WebChannelFactory.cs
- QilFunction.cs
- AutomationPeer.cs
- SqlParameterCollection.cs
- DetailsViewPageEventArgs.cs
- ToolBarButtonClickEvent.cs
- UnsafeNativeMethodsTablet.cs
- SplashScreen.cs
- odbcmetadatafactory.cs
- DbProviderSpecificTypePropertyAttribute.cs
- TakeOrSkipQueryOperator.cs
- DataGridViewColumnConverter.cs
- KeySpline.cs
- XmlSchemaAnyAttribute.cs
- ImmutableCollection.cs
- FontSource.cs
- XPathDocumentBuilder.cs
- TextServicesCompartmentEventSink.cs
- OrderablePartitioner.cs
- TransactionsSectionGroup.cs
- CTreeGenerator.cs
- Pen.cs
- Int64Animation.cs
- ConfigurationManager.cs
- FromRequest.cs
- BamlLocalizableResourceKey.cs
- PhonemeEventArgs.cs
- ScriptingSectionGroup.cs
- FormatSettings.cs
- PackagePartCollection.cs
- DataGridViewTopLeftHeaderCell.cs
- ManagedWndProcTracker.cs
- HMACSHA384.cs
- SapiAttributeParser.cs
- HwndHostAutomationPeer.cs
- DataControlImageButton.cs
- DispatchWrapper.cs
- InsufficientMemoryException.cs
- HttpModulesSection.cs
- ValidationVisibilityAttribute.cs
- HttpClientChannel.cs
- TransformGroup.cs
- CalloutQueueItem.cs
- IUnknownConstantAttribute.cs
- SerializationStore.cs
- ProxyWebPart.cs
- CompilationUtil.cs
- HttpStreamMessageEncoderFactory.cs
- RectangleGeometry.cs
- Wildcard.cs
- EncryptedPackageFilter.cs
- LayoutTableCell.cs
- WpfWebRequestHelper.cs