Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Util / EmptyCollection.cs / 1305376 / EmptyCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * EmptyCollection class * * Copyright (c) 1999 Microsoft Corporation */ namespace System.Web.Util { using System.Collections; /* * Fast implementation of an empty collection */ internal class EmptyCollection: ICollection, IEnumerator { private static EmptyCollection s_theEmptyCollection = new EmptyCollection(); private EmptyCollection() { } // Return the same instance all the time, since it's immutable internal static EmptyCollection Instance { get { return s_theEmptyCollection; } } // ICollection implementation IEnumerator IEnumerable.GetEnumerator() { return this; } public int Count { get { return 0; } } bool ICollection.IsSynchronized { get { return true; } } object ICollection.SyncRoot { get { return this; } } public void CopyTo(Array array, int index) { } // IEnumerator implementation object IEnumerator.Current { get { return null; } } bool IEnumerator.MoveNext() { return false; } void IEnumerator.Reset() { } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * EmptyCollection class * * Copyright (c) 1999 Microsoft Corporation */ namespace System.Web.Util { using System.Collections; /* * Fast implementation of an empty collection */ internal class EmptyCollection: ICollection, IEnumerator { private static EmptyCollection s_theEmptyCollection = new EmptyCollection(); private EmptyCollection() { } // Return the same instance all the time, since it's immutable internal static EmptyCollection Instance { get { return s_theEmptyCollection; } } // ICollection implementation IEnumerator IEnumerable.GetEnumerator() { return this; } public int Count { get { return 0; } } bool ICollection.IsSynchronized { get { return true; } } object ICollection.SyncRoot { get { return this; } } public void CopyTo(Array array, int index) { } // IEnumerator implementation object IEnumerator.Current { get { return null; } } bool IEnumerator.MoveNext() { return false; } void IEnumerator.Reset() { } } } // 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
- WebService.cs
- NativeMethodsOther.cs
- ProtocolViolationException.cs
- SoapCodeExporter.cs
- PolicyException.cs
- RenamedEventArgs.cs
- StreamAsIStream.cs
- StandardBindingElementCollection.cs
- MachineKeyConverter.cs
- Marshal.cs
- SplitterPanel.cs
- SizeF.cs
- DataControlButton.cs
- InstanceOwnerException.cs
- Rotation3D.cs
- ProcessStartInfo.cs
- HintTextMaxWidthConverter.cs
- StrongName.cs
- XmlCDATASection.cs
- BaseComponentEditor.cs
- StrokeNode.cs
- ServiceX509SecurityTokenProvider.cs
- StringAnimationBase.cs
- TouchDevice.cs
- UpdateException.cs
- InputLangChangeEvent.cs
- AnalyzedTree.cs
- PenLineJoinValidation.cs
- RemotingAttributes.cs
- DeploymentSection.cs
- Exceptions.cs
- DbMetaDataFactory.cs
- ClientTarget.cs
- TreeViewItemAutomationPeer.cs
- OperatingSystem.cs
- AgileSafeNativeMemoryHandle.cs
- ClientSideQueueItem.cs
- LinearQuaternionKeyFrame.cs
- Models.cs
- IgnorePropertiesAttribute.cs
- SafeEventLogWriteHandle.cs
- ScrollChrome.cs
- COM2TypeInfoProcessor.cs
- TypeElement.cs
- CompilerScopeManager.cs
- StringInfo.cs
- XPathNavigator.cs
- processwaithandle.cs
- RegularExpressionValidator.cs
- LeaseManager.cs
- PagedDataSource.cs
- OneOfConst.cs
- SmiMetaData.cs
- SqlBulkCopy.cs
- StorageBasedPackageProperties.cs
- recordstate.cs
- FederatedMessageSecurityOverHttp.cs
- XmlEncoding.cs
- InstanceNotReadyException.cs
- NullableLongSumAggregationOperator.cs
- XmlSchemaCollection.cs
- ITreeGenerator.cs
- ReadOnlyDataSourceView.cs
- ConstructorExpr.cs
- ActivitySurrogate.cs
- UpdateTranslator.cs
- StateBag.cs
- HtmlToClrEventProxy.cs
- XPathNavigator.cs
- ElapsedEventArgs.cs
- DataGridViewButtonCell.cs
- AutomationEvent.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- DbProviderServices.cs
- RectAnimationUsingKeyFrames.cs
- DataGridTextBox.cs
- ObjRef.cs
- ViewBox.cs
- AsyncCallback.cs
- DefaultPropertyAttribute.cs
- MediaPlayerState.cs
- ipaddressinformationcollection.cs
- HttpCapabilitiesSectionHandler.cs
- SourceInterpreter.cs
- SessionStateContainer.cs
- SmuggledIUnknown.cs
- SecurityToken.cs
- TreeViewDataItemAutomationPeer.cs
- EmptyEnumerator.cs
- SettingsProviderCollection.cs
- StreamGeometryContext.cs
- AuthorizationPolicyTypeElementCollection.cs
- XmlNodeList.cs
- TextBoxAutomationPeer.cs
- TaskExceptionHolder.cs
- ExecutionContext.cs
- RenderData.cs
- ViewCellSlot.cs
- HtmlForm.cs
- SafeNativeMethods.cs