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
- CompilationPass2Task.cs
- ECDsaCng.cs
- ObjectStateEntry.cs
- Int16KeyFrameCollection.cs
- X509Certificate2.cs
- ControlCollection.cs
- StringReader.cs
- TextBox.cs
- LogEntry.cs
- ListMarkerSourceInfo.cs
- HtmlInputHidden.cs
- DecoderBestFitFallback.cs
- SweepDirectionValidation.cs
- LocalFileSettingsProvider.cs
- XamlBrushSerializer.cs
- ValidatorCompatibilityHelper.cs
- safex509handles.cs
- EntityContainer.cs
- FlowLayoutSettings.cs
- AbsoluteQuery.cs
- TypeContext.cs
- ColorAnimation.cs
- ISAPIWorkerRequest.cs
- ContextTokenTypeConverter.cs
- IEnumerable.cs
- BStrWrapper.cs
- DynamicILGenerator.cs
- Stack.cs
- DoubleCollectionConverter.cs
- HtmlTitle.cs
- UIAgentRequest.cs
- HtmlPageAdapter.cs
- ToolStripDropDown.cs
- XmlProcessingInstruction.cs
- AsymmetricSignatureFormatter.cs
- ParserContext.cs
- ParentUndoUnit.cs
- CompositeFontParser.cs
- MouseGestureValueSerializer.cs
- Vector.cs
- SoapServerMessage.cs
- SHA384Managed.cs
- WebPartUserCapability.cs
- DynamicMetaObject.cs
- UnsafeNativeMethods.cs
- FileRecordSequenceHelper.cs
- IisTraceWebEventProvider.cs
- DoWorkEventArgs.cs
- XmlNavigatorStack.cs
- HttpCapabilitiesBase.cs
- CompoundFileIOPermission.cs
- PropertyCollection.cs
- HostingEnvironmentSection.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- UnmanagedMarshal.cs
- PlatformCulture.cs
- StorageMappingFragment.cs
- CompressEmulationStream.cs
- _WinHttpWebProxyDataBuilder.cs
- TiffBitmapDecoder.cs
- sapiproxy.cs
- UriTemplateMatch.cs
- AttachedPropertyBrowsableAttribute.cs
- HeaderPanel.cs
- PngBitmapDecoder.cs
- DataServiceException.cs
- Variant.cs
- ColumnWidthChangedEvent.cs
- MatrixTransform3D.cs
- PermissionToken.cs
- TableLayoutCellPaintEventArgs.cs
- DocumentViewerBaseAutomationPeer.cs
- Floater.cs
- ComponentCollection.cs
- ellipse.cs
- ControlCollection.cs
- ValidateNames.cs
- GeneralTransform3DCollection.cs
- ProtectedProviderSettings.cs
- CreateSequenceResponse.cs
- SyntaxCheck.cs
- LineGeometry.cs
- MobileUITypeEditor.cs
- IgnoreSection.cs
- Error.cs
- EventLogTraceListener.cs
- OracleBinary.cs
- XmlUtilWriter.cs
- ADRole.cs
- KnownIds.cs
- NotCondition.cs
- ObjectListField.cs
- WindowsFormsSynchronizationContext.cs
- HtmlInputText.cs
- ChannelTraceRecord.cs
- DiagnosticsElement.cs
- DropDownButton.cs
- ActivityMarkupSerializationProvider.cs
- ComponentCommands.cs
- DtrList.cs