Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- ItemChangedEventArgs.cs
- SafeSystemMetrics.cs
- StateBag.cs
- PrintDialog.cs
- OutOfMemoryException.cs
- CodeChecksumPragma.cs
- IndexedString.cs
- AtomServiceDocumentSerializer.cs
- ToolStripProgressBar.cs
- BindingUtils.cs
- FactoryGenerator.cs
- WebEvents.cs
- Int32CollectionValueSerializer.cs
- SecurityException.cs
- SafeNativeMethods.cs
- WebSysDisplayNameAttribute.cs
- FutureFactory.cs
- XmlNavigatorStack.cs
- CfgSemanticTag.cs
- FormViewUpdateEventArgs.cs
- BasicHttpMessageSecurity.cs
- BufferedGraphicsContext.cs
- HttpHandler.cs
- ValueTable.cs
- MLangCodePageEncoding.cs
- SqlUdtInfo.cs
- ActiveXHelper.cs
- LinkLabelLinkClickedEvent.cs
- DataTableClearEvent.cs
- xml.cs
- clipboard.cs
- QilNode.cs
- CodeCommentStatementCollection.cs
- WebPartMenuStyle.cs
- CategoryState.cs
- HelpEvent.cs
- PropertyChangeTracker.cs
- DescriptionAttribute.cs
- EventLogPermission.cs
- Oid.cs
- ArcSegment.cs
- sqlcontext.cs
- XmlNodeChangedEventArgs.cs
- TemplatedAdorner.cs
- AppDomainUnloadedException.cs
- GatewayIPAddressInformationCollection.cs
- SQLDoubleStorage.cs
- RuleDefinitions.cs
- SByteStorage.cs
- CompositeScriptReference.cs
- DynamicRendererThreadManager.cs
- SpecialTypeDataContract.cs
- Point.cs
- OneOfElement.cs
- TemplateBindingExpression.cs
- OleDbPermission.cs
- RadioButton.cs
- Message.cs
- WebPartMenuStyle.cs
- ConnectionsZone.cs
- DataPointer.cs
- Message.cs
- ColorDialog.cs
- DataGridViewSortCompareEventArgs.cs
- WebPartZoneCollection.cs
- DataObject.cs
- ClipboardProcessor.cs
- TableLayoutSettingsTypeConverter.cs
- RayHitTestParameters.cs
- XpsSerializationException.cs
- BoundsDrawingContextWalker.cs
- PropertyMapper.cs
- Attributes.cs
- DataServiceResponse.cs
- DataGridViewCell.cs
- RotationValidation.cs
- RoutedEventArgs.cs
- HtmlForm.cs
- CompilerScopeManager.cs
- QilUnary.cs
- TemplatedWizardStep.cs
- KeyValueConfigurationElement.cs
- DataFormats.cs
- Attributes.cs
- CommandDevice.cs
- LayoutEditorPart.cs
- Interlocked.cs
- HttpProfileBase.cs
- XamlInt32CollectionSerializer.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- PageCodeDomTreeGenerator.cs
- ValidationErrorCollection.cs
- NativeMethodsCLR.cs
- QueryStringHandler.cs
- SecureUICommand.cs
- BidirectionalDictionary.cs
- KeyBinding.cs
- BlockCollection.cs
- XmlSchemaDocumentation.cs
- ValidationSettings.cs