Code:
/ DotNET / DotNET / 8.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
- PathParser.cs
- RoutedEventArgs.cs
- DrawingCollection.cs
- Rotation3DKeyFrameCollection.cs
- CloudCollection.cs
- SchemaSetCompiler.cs
- ToggleButton.cs
- CapabilitiesPattern.cs
- SelectedDatesCollection.cs
- DataRecordObjectView.cs
- MenuItemCollection.cs
- DateTimeFormatInfoScanner.cs
- OleDbParameter.cs
- VersionPair.cs
- GuidelineCollection.cs
- FormClosingEvent.cs
- ObjectDisposedException.cs
- ImageMapEventArgs.cs
- Site.cs
- TypeElementCollection.cs
- DataControlLinkButton.cs
- StringFreezingAttribute.cs
- XamlReader.cs
- MetadataItem.cs
- ResolveMatchesApril2005.cs
- xsdvalidator.cs
- _CacheStreams.cs
- BuiltInExpr.cs
- CompilerWrapper.cs
- ContentValidator.cs
- DriveInfo.cs
- ReadOnlyDictionary.cs
- UnsafeNativeMethodsMilCoreApi.cs
- KeyEvent.cs
- ThemeDictionaryExtension.cs
- QuaternionAnimationBase.cs
- TypeSchema.cs
- SecurityBindingElementImporter.cs
- CfgSemanticTag.cs
- CompositeScriptReferenceEventArgs.cs
- CatalogPartCollection.cs
- WebPartManagerInternals.cs
- TCPClient.cs
- DocumentPaginator.cs
- ClosureBinding.cs
- RightsManagementEncryptedStream.cs
- Renderer.cs
- Quaternion.cs
- ChtmlTextWriter.cs
- WindowsPen.cs
- ManipulationDevice.cs
- designeractionbehavior.cs
- UserValidatedEventArgs.cs
- FontStretches.cs
- DefaultCommandExtensionCallback.cs
- ScriptIgnoreAttribute.cs
- BuildManager.cs
- SynchronousChannel.cs
- InvalidFilterCriteriaException.cs
- PageParserFilter.cs
- PermissionSet.cs
- RoleManagerEventArgs.cs
- WmlTextViewAdapter.cs
- StringFreezingAttribute.cs
- ContainerUtilities.cs
- PropertyValueChangedEvent.cs
- LoaderAllocator.cs
- TypeHelpers.cs
- ResXResourceWriter.cs
- PointF.cs
- PropertyChangeTracker.cs
- SafeArchiveContext.cs
- ErrorStyle.cs
- ColumnResizeUndoUnit.cs
- UiaCoreProviderApi.cs
- Encoder.cs
- CommonProperties.cs
- DirtyTextRange.cs
- SqlDependencyUtils.cs
- arclist.cs
- WebCategoryAttribute.cs
- nulltextcontainer.cs
- IApplicationTrustManager.cs
- OrderingInfo.cs
- Emitter.cs
- ClientRoleProvider.cs
- Span.cs
- TransformDescriptor.cs
- Literal.cs
- SqlRowUpdatedEvent.cs
- Expander.cs
- DependencyPropertyDescriptor.cs
- FileResponseElement.cs
- ProtocolViolationException.cs
- QuaternionIndependentAnimationStorage.cs
- ObjectQueryState.cs
- Cursor.cs
- DocumentPaginator.cs
- TextRangeEditTables.cs
- sqlpipe.cs