Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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. //------------------------------------------------------------------------------ //// 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PerspectiveCamera.cs
- EntityDataSourceValidationException.cs
- RoutingExtensionElement.cs
- FacetDescription.cs
- RectangleGeometry.cs
- ModuleConfigurationInfo.cs
- ControlBuilderAttribute.cs
- SqlDataReaderSmi.cs
- LinqDataSourceContextEventArgs.cs
- SafeArrayRankMismatchException.cs
- _LazyAsyncResult.cs
- TextUtf8RawTextWriter.cs
- IPAddressCollection.cs
- DesignerWidgets.cs
- Source.cs
- MetadataItemSerializer.cs
- AddInStore.cs
- LocationUpdates.cs
- CompositeCollectionView.cs
- ListBase.cs
- updateconfighost.cs
- DataRelationPropertyDescriptor.cs
- MsmqException.cs
- TraceHwndHost.cs
- DbFunctionCommandTree.cs
- ReflectionHelper.cs
- SqlTopReducer.cs
- RecognizedAudio.cs
- WebPartActionVerb.cs
- WebBrowserBase.cs
- TextBox.cs
- CompressEmulationStream.cs
- TypeKeyValue.cs
- StrongName.cs
- brushes.cs
- HMAC.cs
- CompositionTarget.cs
- DataGridItem.cs
- ChannelSinkStacks.cs
- DataGridViewSelectedRowCollection.cs
- TextRangeSerialization.cs
- CodeMethodReturnStatement.cs
- DataMember.cs
- _CookieModule.cs
- TreeSet.cs
- Point3D.cs
- SimpleExpression.cs
- DataColumn.cs
- XmlAnyAttributeAttribute.cs
- UniqueConstraint.cs
- XamlSerializer.cs
- Compiler.cs
- _ShellExpression.cs
- GAC.cs
- TableParaClient.cs
- SwitchAttribute.cs
- ListCollectionView.cs
- MonitorWrapper.cs
- ParserStack.cs
- SqlColumnizer.cs
- BaseAsyncResult.cs
- HttpDictionary.cs
- Trace.cs
- LinqDataSourceDisposeEventArgs.cs
- StrongNameSignatureInformation.cs
- MessageBox.cs
- RuntimeHandles.cs
- AxisAngleRotation3D.cs
- RouteValueExpressionBuilder.cs
- PeerTransportSecurityElement.cs
- XmlNamespaceDeclarationsAttribute.cs
- AppModelKnownContentFactory.cs
- FixedSOMLineRanges.cs
- Signature.cs
- ConfigXmlAttribute.cs
- XXXOnTypeBuilderInstantiation.cs
- ValueChangedEventManager.cs
- XmlAtomicValue.cs
- DataGridViewColumn.cs
- _IPv4Address.cs
- UIEndRequest.cs
- X509CertificateTrustedIssuerElement.cs
- XmlSchemaSequence.cs
- WmfPlaceableFileHeader.cs
- ItemChangedEventArgs.cs
- ObjectKeyFrameCollection.cs
- FrugalList.cs
- AnnotationStore.cs
- SafeHandle.cs
- CompiledIdentityConstraint.cs
- ReturnType.cs
- ADConnectionHelper.cs
- SqlCommand.cs
- SettingsPropertyNotFoundException.cs
- TableRow.cs
- IOException.cs
- MexBindingBindingCollectionElement.cs
- ConfigurationSectionCollection.cs
- EndpointIdentityConverter.cs
- WebResourceAttribute.cs