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
- WriteTimeStream.cs
- InfoCardService.cs
- SoapInteropTypes.cs
- CatalogPartCollection.cs
- ManagementBaseObject.cs
- DbConnectionClosed.cs
- ExpressionPrefixAttribute.cs
- ManipulationCompletedEventArgs.cs
- ContextStaticAttribute.cs
- ToggleProviderWrapper.cs
- SyncMethodInvoker.cs
- ShutDownListener.cs
- DbDataRecord.cs
- RemoteTokenFactory.cs
- XmlDocumentSchema.cs
- CodeAttachEventStatement.cs
- EntityException.cs
- HostProtectionPermission.cs
- ipaddressinformationcollection.cs
- ResourceManager.cs
- RawStylusInputCustomData.cs
- DbConnectionInternal.cs
- EventWaitHandle.cs
- PublisherIdentityPermission.cs
- UnsignedPublishLicense.cs
- EnumerableCollectionView.cs
- InputBindingCollection.cs
- ListenDesigner.cs
- ToolStripGrip.cs
- Matrix.cs
- TableCellAutomationPeer.cs
- WebSysDescriptionAttribute.cs
- RoleService.cs
- XmlnsDictionary.cs
- InternalPermissions.cs
- XmlReflectionMember.cs
- TextRunCache.cs
- SafeFindHandle.cs
- RootProjectionNode.cs
- MsmqHostedTransportManager.cs
- ServiceInstanceProvider.cs
- InternalBufferManager.cs
- CompressStream.cs
- BinaryEditor.cs
- BulletedList.cs
- PolyQuadraticBezierSegment.cs
- PageContentCollection.cs
- XmlIncludeAttribute.cs
- login.cs
- HtmlTable.cs
- SerializationFieldInfo.cs
- SBCSCodePageEncoding.cs
- XmlLanguageConverter.cs
- HashStream.cs
- QuaternionKeyFrameCollection.cs
- NativeRightsManagementAPIsStructures.cs
- CheckBoxField.cs
- IntSecurity.cs
- Pair.cs
- EmptyStringExpandableObjectConverter.cs
- DirectoryObjectSecurity.cs
- TypeInfo.cs
- X509WindowsSecurityToken.cs
- BitVector32.cs
- ModifierKeysValueSerializer.cs
- IdentifierService.cs
- CalloutQueueItem.cs
- ConnectionStringSettingsCollection.cs
- EntityTypeBase.cs
- Ref.cs
- XPathAncestorIterator.cs
- MaskedTextBoxDesignerActionList.cs
- DelegatedStream.cs
- SqlTypesSchemaImporter.cs
- DirectoryGroupQuery.cs
- Bitmap.cs
- ProfileParameter.cs
- SortQuery.cs
- TrustManager.cs
- RequestResizeEvent.cs
- GuidelineCollection.cs
- ButtonField.cs
- OdbcErrorCollection.cs
- ClientRuntimeConfig.cs
- XmlJsonReader.cs
- RuntimeEnvironment.cs
- CodeAssignStatement.cs
- ProjectionPath.cs
- XPathCompiler.cs
- SoapElementAttribute.cs
- WorkItem.cs
- KeyValueConfigurationElement.cs
- mactripleDES.cs
- PlainXmlSerializer.cs
- ListSortDescription.cs
- XmlAttributes.cs
- GeneralTransform2DTo3D.cs
- CodeIndexerExpression.cs
- Version.cs
- CodeGroup.cs