Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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. //------------------------------------------------------------------------------ //// 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BindingSource.cs
- DataRowChangeEvent.cs
- FunctionNode.cs
- CharEntityEncoderFallback.cs
- SpecialNameAttribute.cs
- SettingsPropertyCollection.cs
- OleDbRowUpdatedEvent.cs
- ReachUIElementCollectionSerializerAsync.cs
- MenuAdapter.cs
- DBSqlParserColumn.cs
- WithStatement.cs
- ResourceSetExpression.cs
- DataColumn.cs
- OneOfElement.cs
- SrgsNameValueTag.cs
- ZipIOModeEnforcingStream.cs
- Switch.cs
- _CacheStreams.cs
- SineEase.cs
- PeerNameResolver.cs
- GeneratedContractType.cs
- WebSysDefaultValueAttribute.cs
- RenderContext.cs
- _NegoStream.cs
- BinaryEditor.cs
- UIHelper.cs
- ProxyElement.cs
- RSAOAEPKeyExchangeDeformatter.cs
- uribuilder.cs
- NullableFloatMinMaxAggregationOperator.cs
- UriSection.cs
- AttachedAnnotationChangedEventArgs.cs
- ObjectReferenceStack.cs
- SmtpReplyReaderFactory.cs
- DbConnectionStringCommon.cs
- EntityDesignerDataSourceView.cs
- RangeValidator.cs
- ValueExpressions.cs
- AssociationEndMember.cs
- DocumentXPathNavigator.cs
- MetafileHeader.cs
- DurableInstanceProvider.cs
- SoapElementAttribute.cs
- FileVersion.cs
- SmtpFailedRecipientsException.cs
- cookiecontainer.cs
- HttpServerUtilityWrapper.cs
- EncoderParameter.cs
- NonSerializedAttribute.cs
- MouseButtonEventArgs.cs
- CredentialManagerDialog.cs
- NewItemsContextMenuStrip.cs
- DrawingVisual.cs
- SystemWebSectionGroup.cs
- Comparer.cs
- Application.cs
- ConnectionManagementSection.cs
- PathSegment.cs
- ReleaseInstanceMode.cs
- ObjectAnimationUsingKeyFrames.cs
- Lookup.cs
- InvokePattern.cs
- WarningException.cs
- QuaternionRotation3D.cs
- BlockCollection.cs
- PointLightBase.cs
- CqlParserHelpers.cs
- BaseDataBoundControl.cs
- AVElementHelper.cs
- UserControl.cs
- ComboBox.cs
- TraceHandlerErrorFormatter.cs
- CreateUserWizardStep.cs
- CheckBoxAutomationPeer.cs
- SystemEvents.cs
- Vector3DIndependentAnimationStorage.cs
- ConfigurationHelpers.cs
- ThreadExceptionEvent.cs
- ParameterCollection.cs
- DataTemplateSelector.cs
- Internal.cs
- IteratorFilter.cs
- TypeInfo.cs
- DbProviderSpecificTypePropertyAttribute.cs
- ConfigurationElementCollection.cs
- Page.cs
- StoreConnection.cs
- DispatcherOperation.cs
- DocumentCollection.cs
- NodeCounter.cs
- MarkupCompiler.cs
- XmlDataImplementation.cs
- XmlUtf8RawTextWriter.cs
- HttpException.cs
- HtmlShim.cs
- ConsoleKeyInfo.cs
- ObjectNavigationPropertyMapping.cs
- FixedPage.cs
- DetailsViewUpdateEventArgs.cs
- PropertyEmitterBase.cs