Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- FixedLineResult.cs
- IdnElement.cs
- StylusOverProperty.cs
- RemoteHelper.cs
- PieceNameHelper.cs
- JsonDeserializer.cs
- InvokeBase.cs
- MaskedTextBoxTextEditorDropDown.cs
- ChtmlPhoneCallAdapter.cs
- AnnotationService.cs
- DebugView.cs
- Zone.cs
- dsa.cs
- GeneralTransform3DTo2DTo3D.cs
- Transform3DGroup.cs
- XmlTextWriter.cs
- XmlCompatibilityReader.cs
- SqlTriggerAttribute.cs
- DragDeltaEventArgs.cs
- Table.cs
- ServiceReference.cs
- FullTextLine.cs
- WpfPayload.cs
- PaperSize.cs
- SqlProviderManifest.cs
- MemberDomainMap.cs
- TransformerInfo.cs
- UnmanagedMarshal.cs
- FormViewUpdateEventArgs.cs
- LinkButton.cs
- XmlBinaryWriter.cs
- ObjectManager.cs
- ColorContextHelper.cs
- _DomainName.cs
- DataMemberAttribute.cs
- _SecureChannel.cs
- AdCreatedEventArgs.cs
- TextDecoration.cs
- SvcMapFileSerializer.cs
- SvcMapFileLoader.cs
- ResponseStream.cs
- ItemsPresenter.cs
- X500Name.cs
- MulticastIPAddressInformationCollection.cs
- SingleStorage.cs
- ScriptingWebServicesSectionGroup.cs
- Literal.cs
- ArrayMergeHelper.cs
- EntityContainerEmitter.cs
- SqlUDTStorage.cs
- ToggleButtonAutomationPeer.cs
- ListView.cs
- ListControlActionList.cs
- DirectoryNotFoundException.cs
- XMLSyntaxException.cs
- FontCacheLogic.cs
- SqlInternalConnectionTds.cs
- ActivityCodeGenerator.cs
- UInt32.cs
- DbDataReader.cs
- BindingList.cs
- AuthenticationModuleElement.cs
- EventPrivateKey.cs
- SqlCommandSet.cs
- ProfileSection.cs
- FileUpload.cs
- OracleException.cs
- ServicesUtilities.cs
- KnownTypesProvider.cs
- unitconverter.cs
- ISO2022Encoding.cs
- ValueTypeFixupInfo.cs
- CodeConditionStatement.cs
- UpDownBase.cs
- CharAnimationBase.cs
- LicenseContext.cs
- XmlAttributeCollection.cs
- DNS.cs
- GlyphInfoList.cs
- NullReferenceException.cs
- Array.cs
- LostFocusEventManager.cs
- Scalars.cs
- RouteItem.cs
- IncrementalHitTester.cs
- ExtensionSimplifierMarkupObject.cs
- XmlCompatibilityReader.cs
- ServiceDescriptionReflector.cs
- BitmapPalette.cs
- MediaContextNotificationWindow.cs
- SvcMapFileSerializer.cs
- EntityClassGenerator.cs
- TypeSystemProvider.cs
- COM2IDispatchConverter.cs
- _LocalDataStore.cs
- DisplayMemberTemplateSelector.cs
- TemplateManager.cs
- SecurityContextTokenCache.cs
- WebServiceEnumData.cs
- MenuRendererStandards.cs