Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- MultiAsyncResult.cs
- SqlTriggerContext.cs
- WindowsGraphics.cs
- RegistryPermission.cs
- ArcSegment.cs
- TransactionProtocol.cs
- RetrieveVirtualItemEventArgs.cs
- XXXOnTypeBuilderInstantiation.cs
- SizeConverter.cs
- base64Transforms.cs
- CodeStatementCollection.cs
- XmlSchemaGroupRef.cs
- CodeDirectoryCompiler.cs
- PartialList.cs
- PeerCollaboration.cs
- SettingsAttributeDictionary.cs
- XmlCustomFormatter.cs
- ByteConverter.cs
- Encoder.cs
- XmlSchemaGroupRef.cs
- MenuEventArgs.cs
- ThicknessKeyFrameCollection.cs
- CharConverter.cs
- SqlWorkflowPersistenceService.cs
- ApplicationId.cs
- ConfigUtil.cs
- ColumnPropertiesGroup.cs
- SmtpNetworkElement.cs
- PersianCalendar.cs
- DesignerVerbCollection.cs
- TransformerInfo.cs
- TextClipboardData.cs
- XamlTypeMapper.cs
- documentsequencetextpointer.cs
- HybridDictionary.cs
- FormViewRow.cs
- MouseWheelEventArgs.cs
- TableTextElementCollectionInternal.cs
- FormsAuthentication.cs
- InstanceContextMode.cs
- PageContent.cs
- _SecureChannel.cs
- TrackingMemoryStream.cs
- XmlSchemaAttributeGroup.cs
- AppliedDeviceFiltersEditor.cs
- RegisteredHiddenField.cs
- TextCollapsingProperties.cs
- XmlImplementation.cs
- EntityProviderFactory.cs
- LocalizationComments.cs
- Debug.cs
- SelectiveScrollingGrid.cs
- UnionExpr.cs
- ByteAnimationUsingKeyFrames.cs
- httpapplicationstate.cs
- UnSafeCharBuffer.cs
- XAMLParseException.cs
- LinearQuaternionKeyFrame.cs
- CompareValidator.cs
- GZipDecoder.cs
- RankException.cs
- Matrix3D.cs
- ModifiableIteratorCollection.cs
- Rectangle.cs
- AutoCompleteStringCollection.cs
- WindowsBrush.cs
- IDispatchConstantAttribute.cs
- ResourceManager.cs
- OptimizerPatterns.cs
- InputLangChangeEvent.cs
- NativeCompoundFileAPIs.cs
- SettingsBase.cs
- ECDiffieHellmanCngPublicKey.cs
- Menu.cs
- MdiWindowListItemConverter.cs
- PageParser.cs
- RangeContentEnumerator.cs
- PreloadedPackages.cs
- LinkUtilities.cs
- AxDesigner.cs
- WebEventCodes.cs
- WorkflowQueuingService.cs
- dbenumerator.cs
- FilterElement.cs
- ReflectEventDescriptor.cs
- ToolboxItemFilterAttribute.cs
- ProxyWebPart.cs
- EdmMember.cs
- KeyValuePair.cs
- BindingCollection.cs
- ISSmlParser.cs
- DictionarySectionHandler.cs
- OpenTypeLayoutCache.cs
- XDRSchema.cs
- EmissiveMaterial.cs
- BoundField.cs
- Permission.cs
- CodeObject.cs
- ColumnResult.cs
- DependencyObjectPropertyDescriptor.cs