Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- PanningMessageFilter.cs
- ClockController.cs
- TreeViewItem.cs
- RegularExpressionValidator.cs
- XmlWrappingReader.cs
- HttpRawResponse.cs
- XmlUtf8RawTextWriter.cs
- GenericPrincipal.cs
- AssociationSetEnd.cs
- QueueProcessor.cs
- Route.cs
- PageContentAsyncResult.cs
- ApplicationProxyInternal.cs
- ColumnCollection.cs
- SafeArrayRankMismatchException.cs
- FloatMinMaxAggregationOperator.cs
- MemoryStream.cs
- BitmapDownload.cs
- MdiWindowListStrip.cs
- FunctionOverloadResolver.cs
- ContextProperty.cs
- ToolStripItemTextRenderEventArgs.cs
- AliasedSlot.cs
- ResourceBinder.cs
- BitStack.cs
- SrgsElementFactoryCompiler.cs
- ImageButton.cs
- MsmqIntegrationSecurity.cs
- ExpressionBuilder.cs
- DesignerRegionCollection.cs
- SQLInt16.cs
- XPathNodePointer.cs
- CompilerWrapper.cs
- TextReturnReader.cs
- TreeViewHitTestInfo.cs
- CheckBox.cs
- SecondaryViewProvider.cs
- Helper.cs
- HwndHostAutomationPeer.cs
- RelationshipDetailsRow.cs
- WindowsMenu.cs
- ExpandedWrapper.cs
- AQNBuilder.cs
- XmlSchemaImport.cs
- BooleanToVisibilityConverter.cs
- HttpRuntime.cs
- SQLBoolean.cs
- AutomationProperties.cs
- SqlRetyper.cs
- WebPartChrome.cs
- SqlNamer.cs
- UInt32Storage.cs
- BasePattern.cs
- InstanceHandleConflictException.cs
- XmlDataSource.cs
- BoolExpr.cs
- ParameterModifier.cs
- QilDataSource.cs
- DefaultTextStoreTextComposition.cs
- StylusPointProperty.cs
- CreateUserErrorEventArgs.cs
- LoadedEvent.cs
- XmlEncodedRawTextWriter.cs
- IncrementalReadDecoders.cs
- DnsPermission.cs
- XmlReader.cs
- IconConverter.cs
- CriticalHandle.cs
- FormClosedEvent.cs
- SvcMapFileSerializer.cs
- XmlSerializerFormatAttribute.cs
- CodeEventReferenceExpression.cs
- HtmlInputSubmit.cs
- ArglessEventHandlerProxy.cs
- DBSqlParser.cs
- FormViewDeletedEventArgs.cs
- COM2TypeInfoProcessor.cs
- FontStretches.cs
- SimpleWebHandlerParser.cs
- XmlQualifiedName.cs
- DropAnimation.xaml.cs
- RuntimeWrappedException.cs
- RadioButton.cs
- __TransparentProxy.cs
- JavaScriptObjectDeserializer.cs
- TreeView.cs
- NotificationContext.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- JpegBitmapEncoder.cs
- TailPinnedEventArgs.cs
- ComponentConverter.cs
- ExtensionQuery.cs
- ChangeInterceptorAttribute.cs
- PartitionedStreamMerger.cs
- DbgUtil.cs
- EntityContainerAssociationSet.cs
- Form.cs
- HttpException.cs
- TreeViewItemAutomationPeer.cs
- ProxyWebPartConnectionCollection.cs