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
- BuilderInfo.cs
- DbProviderConfigurationHandler.cs
- WebCategoryAttribute.cs
- StringFormat.cs
- WebHostUnsafeNativeMethods.cs
- CodeTypeDelegate.cs
- sqlcontext.cs
- ExtendedPropertyDescriptor.cs
- TextServicesCompartmentEventSink.cs
- CompositeScriptReference.cs
- OledbConnectionStringbuilder.cs
- LogEntryHeaderv1Deserializer.cs
- CryptoApi.cs
- BitmapEffectInputData.cs
- ResourceSet.cs
- BypassElement.cs
- StringFormat.cs
- CultureInfo.cs
- OciLobLocator.cs
- Misc.cs
- SystemUnicastIPAddressInformation.cs
- EnumMemberAttribute.cs
- StandardRuntimeEnumValidator.cs
- ImageListStreamer.cs
- TrustManagerPromptUI.cs
- Columns.cs
- AttachedAnnotationChangedEventArgs.cs
- Color.cs
- FixedElement.cs
- ToolStripAdornerWindowService.cs
- ToolStripContentPanelRenderEventArgs.cs
- NameSpaceEvent.cs
- IPEndPoint.cs
- EntityClientCacheEntry.cs
- ConfigurationValue.cs
- TCPClient.cs
- CornerRadius.cs
- DateTimeConverter2.cs
- MetadataCollection.cs
- XmlSchemaType.cs
- RequestCacheValidator.cs
- Guid.cs
- TableParaClient.cs
- AnnouncementSendsAsyncResult.cs
- Activator.cs
- JapaneseCalendar.cs
- GrammarBuilder.cs
- NetworkAddressChange.cs
- peernodeimplementation.cs
- RemoteArgument.cs
- Permission.cs
- URLMembershipCondition.cs
- securestring.cs
- WebBrowserPermission.cs
- ServiceProviders.cs
- DESCryptoServiceProvider.cs
- ListViewContainer.cs
- ProcessDesigner.cs
- SerializationInfoEnumerator.cs
- DtrList.cs
- LinqDataSourceEditData.cs
- DataSourceCache.cs
- TransactionProtocol.cs
- LiteralControl.cs
- PassportIdentity.cs
- ExpandedProjectionNode.cs
- BuiltInPermissionSets.cs
- ErrorTableItemStyle.cs
- COM2TypeInfoProcessor.cs
- ZipIOLocalFileDataDescriptor.cs
- SspiHelper.cs
- FileIOPermission.cs
- VectorCollectionValueSerializer.cs
- ObjectListComponentEditor.cs
- ReflectionHelper.cs
- PathSegment.cs
- SelectionPatternIdentifiers.cs
- XmlSchemaCompilationSettings.cs
- ClientBuildManager.cs
- DataServices.cs
- HttpAsyncResult.cs
- SqlNamer.cs
- DefaultBinder.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- CodeTypeReferenceExpression.cs
- StickyNoteHelper.cs
- SchemaSetCompiler.cs
- HttpResponseBase.cs
- XmlSchemaSimpleTypeList.cs
- DictionaryContent.cs
- ToolStripContentPanel.cs
- CallbackHandler.cs
- OdbcParameter.cs
- AffineTransform3D.cs
- OdbcConnectionOpen.cs
- ArgumentNullException.cs
- Composition.cs
- StringPropertyBuilder.cs
- TraceProvider.cs
- assertwrapper.cs