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
- Transform3DGroup.cs
- ConditionalAttribute.cs
- TransactionBridgeSection.cs
- TextElement.cs
- ToolStripButton.cs
- UnknownWrapper.cs
- ClientBuildManagerCallback.cs
- PropertyGeneratedEventArgs.cs
- OdbcParameterCollection.cs
- mediapermission.cs
- ScopedKnownTypes.cs
- SafeThreadHandle.cs
- _IPv4Address.cs
- MultiView.cs
- PingReply.cs
- ClientApiGenerator.cs
- SiteMapDesignerDataSourceView.cs
- SmtpReplyReaderFactory.cs
- UInt32Storage.cs
- PackWebResponse.cs
- IsolatedStorageFileStream.cs
- AttributeCollection.cs
- NativeMethods.cs
- ToolStripItemGlyph.cs
- PaintEvent.cs
- CodeComment.cs
- TraceContextRecord.cs
- ResXResourceReader.cs
- TypedTableBaseExtensions.cs
- UserControlCodeDomTreeGenerator.cs
- StructuredCompositeActivityDesigner.cs
- GroupBoxAutomationPeer.cs
- SystemNetHelpers.cs
- GridViewCellAutomationPeer.cs
- BlobPersonalizationState.cs
- _NegoState.cs
- StylusCaptureWithinProperty.cs
- AtlasWeb.Designer.cs
- HttpConfigurationContext.cs
- AttachedPropertyBrowsableAttribute.cs
- IdnMapping.cs
- MessageQueueInstaller.cs
- AssemblyBuilder.cs
- HttpGetProtocolReflector.cs
- MdiWindowListStrip.cs
- IdnMapping.cs
- TreeNodeBindingCollection.cs
- RangeEnumerable.cs
- IndexedString.cs
- DispatcherExceptionFilterEventArgs.cs
- PrefixHandle.cs
- HttpCacheParams.cs
- ByteAnimation.cs
- GetIndexBinder.cs
- TabRenderer.cs
- XmlDesigner.cs
- BitmapVisualManager.cs
- RijndaelManaged.cs
- Border.cs
- DataGridViewRowCollection.cs
- Size.cs
- NetworkAddressChange.cs
- LinkedResource.cs
- EntityContainerEntitySet.cs
- DataDesignUtil.cs
- DispatcherProcessingDisabled.cs
- SubqueryTrackingVisitor.cs
- ArgumentOutOfRangeException.cs
- PenLineJoinValidation.cs
- SecUtil.cs
- HtmlWindow.cs
- SqlTriggerContext.cs
- EntityDataSourceView.cs
- DataMemberFieldConverter.cs
- DataSourceHelper.cs
- TextChange.cs
- TemplateField.cs
- VisualStates.cs
- WebConfigurationManager.cs
- EmptyStringExpandableObjectConverter.cs
- BindingContext.cs
- DateTimeSerializationSection.cs
- BaseTemplateBuildProvider.cs
- SiteMap.cs
- NumericExpr.cs
- TreeViewDataItemAutomationPeer.cs
- ReliableChannelBinder.cs
- HybridObjectCache.cs
- HierarchicalDataBoundControlAdapter.cs
- MenuItemStyleCollection.cs
- SettingsPropertyValue.cs
- MailSettingsSection.cs
- LeftCellWrapper.cs
- ScriptingJsonSerializationSection.cs
- ZoneIdentityPermission.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- GreenMethods.cs
- ExtensionSimplifierMarkupObject.cs
- AspNetHostingPermission.cs
- MenuItemStyleCollection.cs