Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- PageContentCollection.cs
- XmlBoundElement.cs
- ScriptReferenceEventArgs.cs
- SafeFileMappingHandle.cs
- StringWriter.cs
- ValidatorUtils.cs
- EastAsianLunisolarCalendar.cs
- WebSysDescriptionAttribute.cs
- GridToolTip.cs
- XhtmlConformanceSection.cs
- RelationHandler.cs
- X509Certificate.cs
- SelectorItemAutomationPeer.cs
- ShapeTypeface.cs
- CapabilitiesUse.cs
- RelationshipNavigation.cs
- SafeNativeMethodsMilCoreApi.cs
- Rotation3D.cs
- MILUtilities.cs
- XPathScanner.cs
- ContextMenuAutomationPeer.cs
- DataRowExtensions.cs
- NumberSubstitution.cs
- EntityDataSourceDataSelection.cs
- SimpleHandlerFactory.cs
- CornerRadiusConverter.cs
- GPStream.cs
- coordinator.cs
- PersonalizationEntry.cs
- MenuEventArgs.cs
- FontSizeConverter.cs
- LinqToSqlWrapper.cs
- StreamAsIStream.cs
- SoapAttributes.cs
- SecurityTokenValidationException.cs
- AlternateView.cs
- Attributes.cs
- GridViewSelectEventArgs.cs
- TextSchema.cs
- TypeInfo.cs
- AnnotationAdorner.cs
- TextureBrush.cs
- ToolStripGrip.cs
- SqlExpander.cs
- EdmConstants.cs
- NonClientArea.cs
- FieldTemplateUserControl.cs
- ApplicationId.cs
- BulletedListEventArgs.cs
- MonthCalendar.cs
- CommandDevice.cs
- WebPartConnection.cs
- DataGridViewSelectedCellCollection.cs
- SecurityCapabilities.cs
- XmlSiteMapProvider.cs
- ApplicationServiceHelper.cs
- QualifierSet.cs
- InstanceStore.cs
- XmlC14NWriter.cs
- DataPagerCommandEventArgs.cs
- XmlSchemaAnnotation.cs
- Vector3DCollection.cs
- WindowsMenu.cs
- GiveFeedbackEvent.cs
- EventMappingSettingsCollection.cs
- CurrentChangingEventArgs.cs
- AVElementHelper.cs
- InvalidProgramException.cs
- Operator.cs
- RNGCryptoServiceProvider.cs
- RelationshipEnd.cs
- NumericUpDown.cs
- WebPartsPersonalization.cs
- ResponseStream.cs
- control.ime.cs
- ObsoleteAttribute.cs
- ControllableStoryboardAction.cs
- AnnotationHighlightLayer.cs
- ClientRuntimeConfig.cs
- RuntimeConfig.cs
- CreationContext.cs
- HttpResponseWrapper.cs
- Nodes.cs
- TemplateComponentConnector.cs
- XmlEntityReference.cs
- ModelServiceImpl.cs
- SettingsPropertyIsReadOnlyException.cs
- SecureEnvironment.cs
- MsdtcWrapper.cs
- InstalledFontCollection.cs
- Root.cs
- TextHidden.cs
- IImplicitResourceProvider.cs
- ConnectionManagementSection.cs
- ProfilePropertySettingsCollection.cs
- Vector3DValueSerializer.cs
- ImageListUtils.cs
- AssemblyHash.cs
- XamlRtfConverter.cs
- AutomationFocusChangedEventArgs.cs