Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Util / SingleObjectCollection.cs / 1305376 / 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
- CodeTypeMemberCollection.cs
- SqlFactory.cs
- Helper.cs
- ListViewDeleteEventArgs.cs
- CompositeFontFamily.cs
- Encoder.cs
- ValueQuery.cs
- ToolboxBitmapAttribute.cs
- SchemaElementDecl.cs
- ConversionContext.cs
- Decoder.cs
- IdentityManager.cs
- SynchronizedInputPattern.cs
- ValidatorCollection.cs
- QilCloneVisitor.cs
- Content.cs
- LocationInfo.cs
- GridErrorDlg.cs
- XmlCompatibilityReader.cs
- StoreItemCollection.Loader.cs
- FolderBrowserDialog.cs
- NamedPermissionSet.cs
- CodeEntryPointMethod.cs
- WebPartConnectionsEventArgs.cs
- ContentElementAutomationPeer.cs
- FixedSOMTableRow.cs
- DesignerVerbCollection.cs
- XmlValidatingReader.cs
- PauseStoryboard.cs
- ProgressPage.cs
- SendKeys.cs
- ImageSource.cs
- SortedDictionary.cs
- SchemaNamespaceManager.cs
- PageAsyncTask.cs
- TypeUtils.cs
- COM2TypeInfoProcessor.cs
- DrawingContextWalker.cs
- BooleanExpr.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- DashStyles.cs
- ChildDocumentBlock.cs
- EntityViewGenerator.cs
- ButtonChrome.cs
- UnmanagedMemoryStream.cs
- Oci.cs
- FormsAuthenticationTicket.cs
- iisPickupDirectory.cs
- JulianCalendar.cs
- ResourceContainer.cs
- httpapplicationstate.cs
- TextFormatterHost.cs
- SQLGuidStorage.cs
- PcmConverter.cs
- EpmSyndicationContentSerializer.cs
- PrintDialog.cs
- PersonalizationEntry.cs
- DataGridColumnCollection.cs
- BulletedList.cs
- XmlAttribute.cs
- Label.cs
- OracleBFile.cs
- InternalCache.cs
- MaskedTextProvider.cs
- DeferredBinaryDeserializerExtension.cs
- WindowHelperService.cs
- SignatureHelper.cs
- FileRecordSequenceHelper.cs
- RemoteArgument.cs
- wgx_sdk_version.cs
- WebConfigurationHost.cs
- Faults.cs
- SettingsPropertyValueCollection.cs
- VScrollProperties.cs
- VisualStyleTypesAndProperties.cs
- WindowsPrincipal.cs
- MulticastOption.cs
- ContextStaticAttribute.cs
- StylusPoint.cs
- ResourceAttributes.cs
- TargetException.cs
- ListView.cs
- WebPartDisplayModeCancelEventArgs.cs
- ThemeInfoAttribute.cs
- XslAst.cs
- StubHelpers.cs
- WorkerRequest.cs
- Int32RectValueSerializer.cs
- CommandHelper.cs
- SettingsPropertyCollection.cs
- WindowsPrincipal.cs
- SimpleBitVector32.cs
- SerialPort.cs
- RelationshipEnd.cs
- RtfToXamlLexer.cs
- FixedTextView.cs
- InputBinder.cs
- SimpleApplicationHost.cs
- AnnotationHelper.cs
- DragDrop.cs