Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PropertyStore.cs
- Identifier.cs
- StandardCommandToolStripMenuItem.cs
- AngleUtil.cs
- AbsoluteQuery.cs
- Graphics.cs
- WebHttpDispatchOperationSelector.cs
- VariantWrapper.cs
- MaskDescriptor.cs
- FontWeightConverter.cs
- ButtonChrome.cs
- CursorConverter.cs
- LayoutEngine.cs
- SqlAliasesReferenced.cs
- InvalidOleVariantTypeException.cs
- Page.cs
- StylusOverProperty.cs
- SecurityNegotiationException.cs
- EntityUtil.cs
- CacheHelper.cs
- WorkflowTransactionOptions.cs
- SR.cs
- AssemblyUtil.cs
- SessionStateItemCollection.cs
- HandlerMappingMemo.cs
- OptimizedTemplateContentHelper.cs
- DataServiceQueryProvider.cs
- InfoCardUIAgent.cs
- StreamGeometry.cs
- AdPostCacheSubstitution.cs
- DATA_BLOB.cs
- PartitionedDataSource.cs
- TextEffectResolver.cs
- PreservationFileReader.cs
- AudioSignalProblemOccurredEventArgs.cs
- ValueSerializer.cs
- RedirectionProxy.cs
- PublisherMembershipCondition.cs
- AspCompat.cs
- BypassElement.cs
- ScrollViewer.cs
- WorkflowPageSetupDialog.cs
- Message.cs
- TraceContext.cs
- InvalidEnumArgumentException.cs
- EncoderParameters.cs
- TypeUtil.cs
- JobCollate.cs
- Page.cs
- DataGridTableStyleMappingNameEditor.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- SID.cs
- ContentFileHelper.cs
- BaseWebProxyFinder.cs
- CredentialCache.cs
- WindowsFormsLinkLabel.cs
- SiteMapNodeItem.cs
- MediaEntryAttribute.cs
- TextRangeAdaptor.cs
- WindowsToolbarAsMenu.cs
- DocumentPageTextView.cs
- JournalEntryListConverter.cs
- ReaderWriterLock.cs
- EventLogPermissionEntry.cs
- IndentTextWriter.cs
- SettingsPropertyNotFoundException.cs
- HandleRef.cs
- XhtmlBasicLinkAdapter.cs
- XmlCustomFormatter.cs
- XpsFixedDocumentReaderWriter.cs
- DataGridViewRowPrePaintEventArgs.cs
- WebZoneDesigner.cs
- DelegateSerializationHolder.cs
- HighContrastHelper.cs
- followingquery.cs
- HtmlInputHidden.cs
- ReferencedType.cs
- PolicyValidationException.cs
- RSAProtectedConfigurationProvider.cs
- EntitySet.cs
- RemotingException.cs
- XmlComment.cs
- Label.cs
- IsolatedStorage.cs
- Formatter.cs
- PeerToPeerException.cs
- EnumUnknown.cs
- MultipleViewPattern.cs
- TimeoutException.cs
- lengthconverter.cs
- ProfileGroupSettings.cs
- XmlNodeReader.cs
- BookmarkScopeHandle.cs
- SchemaMapping.cs
- SystemIPGlobalStatistics.cs
- ManipulationLogic.cs
- FontResourceCache.cs
- Command.cs
- ViewValidator.cs
- bidPrivateBase.cs