Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LogRecordSequence.cs
- ExceptionUtil.cs
- BulletDecorator.cs
- ArrayWithOffset.cs
- ElementAction.cs
- Win32Exception.cs
- SelectionEditingBehavior.cs
- XmlAnyElementAttributes.cs
- TextRunTypographyProperties.cs
- ApplicationInterop.cs
- XmlAtomicValue.cs
- localization.cs
- StrongBox.cs
- SynchronizationContext.cs
- StreamingContext.cs
- Ray3DHitTestResult.cs
- XmlFormatWriterGenerator.cs
- ValidatorCompatibilityHelper.cs
- XslAst.cs
- TypeConverters.cs
- MouseGestureConverter.cs
- codemethodreferenceexpression.cs
- ObfuscateAssemblyAttribute.cs
- TextRunCacheImp.cs
- TextSelection.cs
- FixedBufferAttribute.cs
- FlowDocumentPage.cs
- ISO2022Encoding.cs
- GregorianCalendar.cs
- DeferredSelectedIndexReference.cs
- ValueChangedEventManager.cs
- StoryFragments.cs
- DataServiceHostWrapper.cs
- EntityCollection.cs
- SelectedDatesCollection.cs
- PeerCollaborationPermission.cs
- Delegate.cs
- AttachedPropertyDescriptor.cs
- CompatibleComparer.cs
- EntityDesignerBuildProvider.cs
- ProcessManager.cs
- TdsParserSafeHandles.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- ColorTranslator.cs
- DataComponentGenerator.cs
- WebPartConnectionCollection.cs
- ZoneIdentityPermission.cs
- ExtenderProvidedPropertyAttribute.cs
- WrapperEqualityComparer.cs
- GroupBoxRenderer.cs
- UpDownBase.cs
- DataGridViewCellCancelEventArgs.cs
- OptimalTextSource.cs
- Item.cs
- ExpressionVisitorHelpers.cs
- EnumType.cs
- SecurityAccessDeniedException.cs
- WSHttpTransportSecurityElement.cs
- PenLineCapValidation.cs
- CoTaskMemSafeHandle.cs
- FontCollection.cs
- PtsPage.cs
- OrCondition.cs
- IDReferencePropertyAttribute.cs
- ReflectionPermission.cs
- bindurihelper.cs
- ExtendLockCommand.cs
- Thickness.cs
- IconBitmapDecoder.cs
- PropertyStore.cs
- PageContentCollection.cs
- CalendarDayButton.cs
- TraceListener.cs
- EntityDesignerUtils.cs
- Wizard.cs
- SerializableAttribute.cs
- FamilyTypefaceCollection.cs
- HttpRequest.cs
- DiscardableAttribute.cs
- HttpWriter.cs
- MultiPageTextView.cs
- QueryGeneratorBase.cs
- Int32Rect.cs
- TagPrefixAttribute.cs
- Regex.cs
- EventSinkHelperWriter.cs
- SearchForVirtualItemEventArgs.cs
- StylusPointProperty.cs
- ObjectDataSourceDesigner.cs
- RijndaelManaged.cs
- ValidationError.cs
- VerticalConnector.xaml.cs
- GridViewUpdatedEventArgs.cs
- NotifyIcon.cs
- ControlAdapter.cs
- PathTooLongException.cs
- ComplexType.cs
- MessageQueuePermissionAttribute.cs
- UICuesEvent.cs
- contentDescriptor.cs