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
- CfgRule.cs
- EventMap.cs
- HtmlInputReset.cs
- Delegate.cs
- CheckBoxBaseAdapter.cs
- ContractMapping.cs
- ZipIOExtraFieldPaddingElement.cs
- columnmapkeybuilder.cs
- GenericWebPart.cs
- XmlSecureResolver.cs
- DispatcherEventArgs.cs
- JournalEntry.cs
- OrderedDictionary.cs
- ByteStorage.cs
- Int32Storage.cs
- LinqDataSourceDeleteEventArgs.cs
- ReferenceEqualityComparer.cs
- IncrementalHitTester.cs
- EventDescriptorCollection.cs
- _UriSyntax.cs
- WebPartConnectionsDisconnectVerb.cs
- userdatakeys.cs
- CalendarTable.cs
- RewritingProcessor.cs
- SessionEndingEventArgs.cs
- RSACryptoServiceProvider.cs
- DocumentApplicationJournalEntry.cs
- _LocalDataStoreMgr.cs
- HtmlTextArea.cs
- InvalidDocumentContentsException.cs
- RegionIterator.cs
- Transform.cs
- NetworkAddressChange.cs
- NamedPipeAppDomainProtocolHandler.cs
- DataGridCommandEventArgs.cs
- DriveNotFoundException.cs
- ConfigurationManager.cs
- StorageRoot.cs
- ViewSimplifier.cs
- HtmlInputButton.cs
- MailHeaderInfo.cs
- Button.cs
- Viewport3DAutomationPeer.cs
- SingleResultAttribute.cs
- EnumBuilder.cs
- XmlJsonWriter.cs
- BaseParser.cs
- ProfileSettingsCollection.cs
- ListMarkerLine.cs
- HttpPostedFileWrapper.cs
- PageSettings.cs
- HttpPostedFile.cs
- returneventsaver.cs
- DbDataRecord.cs
- EntityDataSourceWizardForm.cs
- Control.cs
- SqlCommandSet.cs
- ApplicationInfo.cs
- AutomationPatternInfo.cs
- CodeDelegateInvokeExpression.cs
- OdbcRowUpdatingEvent.cs
- InstanceCreationEditor.cs
- MenuItemBinding.cs
- BinaryKeyIdentifierClause.cs
- UriSchemeKeyedCollection.cs
- CodeObjectCreateExpression.cs
- _BufferOffsetSize.cs
- OrderedDictionaryStateHelper.cs
- TreeNodeEventArgs.cs
- Quad.cs
- XmlName.cs
- StorageMappingItemLoader.cs
- EmptyImpersonationContext.cs
- SecurityProtocolFactory.cs
- HashStream.cs
- FontDriver.cs
- RelationshipConstraintValidator.cs
- LayoutEngine.cs
- DesignerSerializerAttribute.cs
- Int64KeyFrameCollection.cs
- DesignTimeVisibleAttribute.cs
- WebPartPersonalization.cs
- InfoCardRSACryptoProvider.cs
- ListCollectionView.cs
- ObjectAnimationUsingKeyFrames.cs
- HashJoinQueryOperatorEnumerator.cs
- BatchServiceHost.cs
- EdgeModeValidation.cs
- TokenBasedSet.cs
- CollectionBase.cs
- RelationshipWrapper.cs
- _ChunkParse.cs
- URLAttribute.cs
- ObjectDataSourceView.cs
- BindingContext.cs
- DelegatingStream.cs
- SourceChangedEventArgs.cs
- PageEventArgs.cs
- XmlSchemaValidationException.cs
- SafeNativeMethods.cs