Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Util / SingleObjectCollection.cs / 1305376 / 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
- UIElement.cs
- RightsManagementInformation.cs
- QilNode.cs
- UIServiceHelper.cs
- CriticalHandle.cs
- dtdvalidator.cs
- XmlCharType.cs
- InvalidateEvent.cs
- BasicCellRelation.cs
- WebBrowserPermission.cs
- documentsequencetextpointer.cs
- ProvidersHelper.cs
- Misc.cs
- SqlClientFactory.cs
- UpdateExpressionVisitor.cs
- ObfuscationAttribute.cs
- CodeTypeConstructor.cs
- SR.cs
- ConfigurationConverterBase.cs
- EntityFunctions.cs
- XamlParser.cs
- BasePropertyDescriptor.cs
- COM2PictureConverter.cs
- LinearGradientBrush.cs
- EntityReference.cs
- StyleHelper.cs
- CompleteWizardStep.cs
- DynamicPropertyHolder.cs
- TreeNode.cs
- XamlSerializer.cs
- OperationInfo.cs
- RegexFCD.cs
- ArraySet.cs
- ThreadAttributes.cs
- DictionaryBase.cs
- Point.cs
- DeriveBytes.cs
- Aggregates.cs
- returneventsaver.cs
- CodeValidator.cs
- SetterBaseCollection.cs
- AnnouncementInnerClient11.cs
- WSSecurityPolicy12.cs
- TableAutomationPeer.cs
- StringSource.cs
- CodeActivity.cs
- GenericsInstances.cs
- GradientBrush.cs
- HttpRuntimeSection.cs
- AuthenticationSection.cs
- DBConnection.cs
- EventEntry.cs
- HandlerMappingMemo.cs
- DrawingAttributesDefaultValueFactory.cs
- CodeCompileUnit.cs
- BindableAttribute.cs
- XmlnsDictionary.cs
- ToolBarButtonDesigner.cs
- UpdateCommand.cs
- FormattedTextSymbols.cs
- LicenseManager.cs
- PageThemeCodeDomTreeGenerator.cs
- RequestedSignatureDialog.cs
- ScriptHandlerFactory.cs
- PageThemeBuildProvider.cs
- ConfigurationElementProperty.cs
- LineGeometry.cs
- RuntimeVariableList.cs
- URL.cs
- SchemeSettingElementCollection.cs
- Table.cs
- DrawingState.cs
- ServiceCredentials.cs
- Registry.cs
- _UriSyntax.cs
- XDRSchema.cs
- TriggerAction.cs
- Splitter.cs
- AttributeConverter.cs
- TempFiles.cs
- TableRowCollection.cs
- NavigationPropertyAccessor.cs
- StackSpiller.cs
- RangeContentEnumerator.cs
- RoutedEvent.cs
- Part.cs
- Int32RectConverter.cs
- DataGridViewSelectedCellCollection.cs
- DetailsViewDeletedEventArgs.cs
- BufferBuilder.cs
- UrlMappingsModule.cs
- EntityProviderFactory.cs
- WindowAutomationPeer.cs
- ServiceChannelProxy.cs
- EventLogPermissionEntry.cs
- UnmanagedMemoryStream.cs
- SqlConnectionStringBuilder.cs
- DataPagerFieldItem.cs
- RectangleGeometry.cs
- WebConfigurationFileMap.cs