Code:
/ FX-1434 / FX-1434 / 1.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
- DocumentReferenceCollection.cs
- DomainUpDown.cs
- CustomValidator.cs
- Icon.cs
- SqlServices.cs
- AppendHelper.cs
- TaskFileService.cs
- FileFormatException.cs
- Clock.cs
- Soap12ProtocolImporter.cs
- ActivityExecutor.cs
- KeySpline.cs
- TextParaLineResult.cs
- GridViewDeletedEventArgs.cs
- MouseDevice.cs
- IdentityNotMappedException.cs
- HttpBrowserCapabilitiesWrapper.cs
- SqlClientWrapperSmiStreamChars.cs
- GridViewRow.cs
- CompModSwitches.cs
- GiveFeedbackEventArgs.cs
- ExitEventArgs.cs
- GrammarBuilderRuleRef.cs
- IISUnsafeMethods.cs
- CompositeCollectionView.cs
- BufferBuilder.cs
- MediaContext.cs
- ExceptionHandler.cs
- BuildResultCache.cs
- DirectoryObjectSecurity.cs
- HtmlTitle.cs
- DatasetMethodGenerator.cs
- ToolboxComponentsCreatingEventArgs.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ControlEvent.cs
- LocalValueEnumerator.cs
- TearOffProxy.cs
- FormatVersion.cs
- TableLayoutSettings.cs
- TableRowCollection.cs
- KoreanCalendar.cs
- RotationValidation.cs
- CodeDomComponentSerializationService.cs
- MethodCallTranslator.cs
- ListGeneralPage.cs
- SettingsProviderCollection.cs
- SoapFault.cs
- XslAstAnalyzer.cs
- ArrayExtension.cs
- SmtpFailedRecipientsException.cs
- DefaultObjectMappingItemCollection.cs
- PersistenceTask.cs
- ThicknessConverter.cs
- HtmlTernaryTree.cs
- TabControl.cs
- ApplicationDirectory.cs
- XAMLParseException.cs
- FrameworkContentElement.cs
- TransportListener.cs
- ItemsChangedEventArgs.cs
- XmlSchemaIdentityConstraint.cs
- EventLogEntryCollection.cs
- TransactionFlowElement.cs
- AuthenticatedStream.cs
- SemanticKeyElement.cs
- ColumnMapVisitor.cs
- XPathQilFactory.cs
- TextBoxBaseDesigner.cs
- ImmutableCommunicationTimeouts.cs
- ResourceDictionaryCollection.cs
- GridLength.cs
- DataGridViewColumnConverter.cs
- TextOnlyOutput.cs
- UndoEngine.cs
- HtmlAnchor.cs
- CompoundFileStreamReference.cs
- SQlBooleanStorage.cs
- TableHeaderCell.cs
- cache.cs
- EventDescriptorCollection.cs
- VisualCollection.cs
- SystemIcmpV6Statistics.cs
- DataGridViewCellValidatingEventArgs.cs
- FontDriver.cs
- AsyncResult.cs
- ConstNode.cs
- RowSpanVector.cs
- WebProxyScriptElement.cs
- WebHttpElement.cs
- SeekStoryboard.cs
- CultureInfo.cs
- CompilerWrapper.cs
- HostingEnvironment.cs
- EventLogPermissionAttribute.cs
- BinaryUtilClasses.cs
- SqlRecordBuffer.cs
- Visual.cs
- ControlValuePropertyAttribute.cs
- NativeMethods.cs
- FontWeights.cs