Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- UrlPath.cs
- ControlCollection.cs
- DefaultTextStore.cs
- SqlDataSourceEnumerator.cs
- EmptyStringExpandableObjectConverter.cs
- GrammarBuilderBase.cs
- MissingMethodException.cs
- TraceSource.cs
- RankException.cs
- DataControlPagerLinkButton.cs
- UnknownWrapper.cs
- ModuleBuilder.cs
- SecurityHeaderElementInferenceEngine.cs
- DataView.cs
- TypedTableBaseExtensions.cs
- ConfigurationSection.cs
- UserControl.cs
- TableAdapterManagerMethodGenerator.cs
- TextOnlyOutput.cs
- MemberInfoSerializationHolder.cs
- SqlErrorCollection.cs
- BindingCompleteEventArgs.cs
- CalendarKeyboardHelper.cs
- CompModSwitches.cs
- Font.cs
- XmlNavigatorStack.cs
- WebBrowser.cs
- FunctionDetailsReader.cs
- PackWebResponse.cs
- DeclarationUpdate.cs
- SessionEndingEventArgs.cs
- ColumnResult.cs
- CommentEmitter.cs
- WinEventWrap.cs
- BrowserCapabilitiesFactoryBase.cs
- BoundField.cs
- SemanticBasicElement.cs
- SequentialWorkflowHeaderFooter.cs
- ForceCopyBuildProvider.cs
- Menu.cs
- Grant.cs
- FullTextLine.cs
- Input.cs
- DataProtection.cs
- RegionData.cs
- GridViewEditEventArgs.cs
- KeyboardDevice.cs
- SoapHttpTransportImporter.cs
- AttachedAnnotationChangedEventArgs.cs
- ADRoleFactoryConfiguration.cs
- HtmlProps.cs
- EventHandlersStore.cs
- DropDownList.cs
- ITreeGenerator.cs
- Command.cs
- WmpBitmapDecoder.cs
- SystemTcpStatistics.cs
- MessageBox.cs
- DynamicValidator.cs
- XmlDataSourceView.cs
- ConfigurationValue.cs
- DiscreteKeyFrames.cs
- LineGeometry.cs
- CapabilitiesRule.cs
- FixedSOMTextRun.cs
- CharacterString.cs
- DataBoundControl.cs
- DependencyPropertyKey.cs
- FlowLayoutSettings.cs
- SmiXetterAccessMap.cs
- ObjectItemCachedAssemblyLoader.cs
- FileCodeGroup.cs
- ProviderConnectionPoint.cs
- NextPreviousPagerField.cs
- PaginationProgressEventArgs.cs
- UpdateException.cs
- InternalCache.cs
- ITextView.cs
- SamlDoNotCacheCondition.cs
- PartitionerStatic.cs
- BindingMAnagerBase.cs
- ToolStripContentPanelRenderEventArgs.cs
- DateTimeConverter.cs
- Light.cs
- Attributes.cs
- LassoHelper.cs
- DecoratedNameAttribute.cs
- ObjectDataSourceFilteringEventArgs.cs
- SelectionService.cs
- DataSourceExpressionCollection.cs
- ConnectionConsumerAttribute.cs
- PriorityBindingExpression.cs
- Point3DCollection.cs
- RequestedSignatureDialog.cs
- ObjectListDataBindEventArgs.cs
- DebugView.cs
- TextDecoration.cs
- PropertyItem.cs
- RemoteWebConfigurationHostServer.cs
- TextChange.cs