Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- SimpleType.cs
- TreeNodeStyleCollection.cs
- MetafileHeaderWmf.cs
- ToolBar.cs
- PresentationAppDomainManager.cs
- DiscoveryMessageSequenceCD1.cs
- MessageDirection.cs
- GridViewSelectEventArgs.cs
- FrameworkName.cs
- ToolStripDesignerAvailabilityAttribute.cs
- DataControlFieldHeaderCell.cs
- ListViewGroup.cs
- MasterPageBuildProvider.cs
- FontStyleConverter.cs
- ThemeDictionaryExtension.cs
- ArrangedElementCollection.cs
- BamlTreeMap.cs
- XhtmlBasicLabelAdapter.cs
- TrackingDataItem.cs
- ConnectionStringSettingsCollection.cs
- WebControlAdapter.cs
- HttpListenerResponse.cs
- StringHelper.cs
- XPathNavigatorReader.cs
- TemplateXamlParser.cs
- OrderedEnumerableRowCollection.cs
- ImageBrush.cs
- AssemblyInfo.cs
- ProcessHostFactoryHelper.cs
- ChameleonKey.cs
- TypeDelegator.cs
- RadioButton.cs
- SingleTagSectionHandler.cs
- NamespaceImport.cs
- InfoCardBaseException.cs
- WaitHandle.cs
- SafeThreadHandle.cs
- SystemIPGlobalProperties.cs
- PrivateFontCollection.cs
- DesignerView.xaml.cs
- PropertyInfoSet.cs
- TemplateControlBuildProvider.cs
- CodeConstructor.cs
- SpeakInfo.cs
- AssemblyInfo.cs
- UniformGrid.cs
- TerminateDesigner.cs
- BinaryHeap.cs
- AsyncOperation.cs
- WebPartEventArgs.cs
- PagerStyle.cs
- EnlistmentTraceIdentifier.cs
- TemplateManager.cs
- AdCreatedEventArgs.cs
- AttributeCollection.cs
- MatchingStyle.cs
- DocumentManager.cs
- Light.cs
- FrameworkContentElementAutomationPeer.cs
- DataGridViewCellStateChangedEventArgs.cs
- OutputCacheSettingsSection.cs
- WorkflowInstanceAbortedRecord.cs
- StreamWriter.cs
- ImageCodecInfo.cs
- MailWebEventProvider.cs
- AsynchronousChannelMergeEnumerator.cs
- AppliesToBehaviorDecisionTable.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- PrintPreviewDialog.cs
- XmlSchemas.cs
- XmlLoader.cs
- TargetParameterCountException.cs
- ZipFileInfoCollection.cs
- TransportSecurityBindingElement.cs
- BackgroundFormatInfo.cs
- HighlightVisual.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- DropDownList.cs
- WebRequestModulesSection.cs
- AssociationSetEnd.cs
- PropertyPushdownHelper.cs
- DataTableMappingCollection.cs
- HttpCookie.cs
- DataPager.cs
- XamlDesignerSerializationManager.cs
- SymLanguageType.cs
- ObjectDataSourceStatusEventArgs.cs
- ResourceAttributes.cs
- SqlDataSource.cs
- recordstate.cs
- Matrix.cs
- EpmSyndicationContentSerializer.cs
- UDPClient.cs
- VisualStyleRenderer.cs
- AmbientLight.cs
- VoiceSynthesis.cs
- FusionWrap.cs
- CodeMemberEvent.cs
- InvalidFilterCriteriaException.cs
- CommentEmitter.cs