Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / Documents / DocumentReferenceCollection.cs / 1 / DocumentReferenceCollection.cs
//---------------------------------------------------------------------------- //// Copyright (C) 2004 by Microsoft Corporation. All rights reserved. // // // Description: // Implements the DocumentReferenceCollection as holder for a collection // of DocumentReference // // History: // 05/07/2004 - Zhenbin Xu (ZhenbinX) - Created. // // //--------------------------------------------------------------------------- namespace System.Windows.Documents { using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; //===================================================================== ////// DocumentReferenceCollection is an ordered collection of DocumentReference /// [CLSCompliant(false)] public sealed class DocumentReferenceCollection : IEnumerable, INotifyCollectionChanged { //------------------------------------------------------------------- // // Connstructors // //---------------------------------------------------------------------- #region Constructors internal DocumentReferenceCollection() { } #endregion Constructors //------------------------------------------------------------------- // // Public Methods // //---------------------------------------------------------------------- #region Public Methods #region IEnumerable /// /// /// public IEnumeratorGetEnumerator() { return _InternalList.GetEnumerator(); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return ((IEnumerable )this).GetEnumerator(); } #endregion IEnumerable /// /// /// public void Add(DocumentReference item) { int count = _InternalList.Count; _InternalList.Add(item); OnCollectionChanged(NotifyCollectionChangedAction.Add, item, count); } ////// Passes in document reference array to be copied /// public void CopyTo(DocumentReference[] array, int arrayIndex) { _InternalList.CopyTo(array, arrayIndex); } #endregion Public Methods #region Public Properties ////// Count of Document References in collection /// public int Count { get { return _InternalList.Count; } } ////// /// public DocumentReference this[int index] { get { return _InternalList[index]; } } #endregion Public Properties //-------------------------------------------------------------------- // // Public Events // //--------------------------------------------------------------------- #region Public Event ////// Occurs when the collection changes, either by adding or removing an item. /// ////// see public event NotifyCollectionChangedEventHandler CollectionChanged; #endregion Public Event //-------------------------------------------------------------------- // // private Properties // //--------------------------------------------------------------------- #region Private Properties // Aggregated IList private IList/// _InternalList { get { if (_internalList == null) { _internalList = new List (); } return _internalList; } } #endregion Private Properties #region Private Methods //------------------------------------------------------------------- // // Private Methods // //--------------------------------------------------------------------- // fire CollectionChanged event to any listeners private void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index) { if (CollectionChanged != null) { NotifyCollectionChangedEventArgs args; args = new NotifyCollectionChangedEventArgs(action, item, index); CollectionChanged(this, args); } } #endregion Private Methods //-------------------------------------------------------------------- // // Private Fields // //--------------------------------------------------------------------- #region Private Fields private List _internalList; #endregion Private Fields } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // Copyright (C) 2004 by Microsoft Corporation. All rights reserved. // // // Description: // Implements the DocumentReferenceCollection as holder for a collection // of DocumentReference // // History: // 05/07/2004 - Zhenbin Xu (ZhenbinX) - Created. // // //--------------------------------------------------------------------------- namespace System.Windows.Documents { using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; //===================================================================== ////// DocumentReferenceCollection is an ordered collection of DocumentReference /// [CLSCompliant(false)] public sealed class DocumentReferenceCollection : IEnumerable, INotifyCollectionChanged { //------------------------------------------------------------------- // // Connstructors // //---------------------------------------------------------------------- #region Constructors internal DocumentReferenceCollection() { } #endregion Constructors //------------------------------------------------------------------- // // Public Methods // //---------------------------------------------------------------------- #region Public Methods #region IEnumerable /// /// /// public IEnumeratorGetEnumerator() { return _InternalList.GetEnumerator(); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return ((IEnumerable )this).GetEnumerator(); } #endregion IEnumerable /// /// /// public void Add(DocumentReference item) { int count = _InternalList.Count; _InternalList.Add(item); OnCollectionChanged(NotifyCollectionChangedAction.Add, item, count); } ////// Passes in document reference array to be copied /// public void CopyTo(DocumentReference[] array, int arrayIndex) { _InternalList.CopyTo(array, arrayIndex); } #endregion Public Methods #region Public Properties ////// Count of Document References in collection /// public int Count { get { return _InternalList.Count; } } ////// /// public DocumentReference this[int index] { get { return _InternalList[index]; } } #endregion Public Properties //-------------------------------------------------------------------- // // Public Events // //--------------------------------------------------------------------- #region Public Event ////// Occurs when the collection changes, either by adding or removing an item. /// ////// see public event NotifyCollectionChangedEventHandler CollectionChanged; #endregion Public Event //-------------------------------------------------------------------- // // private Properties // //--------------------------------------------------------------------- #region Private Properties // Aggregated IList private IList/// _InternalList { get { if (_internalList == null) { _internalList = new List (); } return _internalList; } } #endregion Private Properties #region Private Methods //------------------------------------------------------------------- // // Private Methods // //--------------------------------------------------------------------- // fire CollectionChanged event to any listeners private void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index) { if (CollectionChanged != null) { NotifyCollectionChangedEventArgs args; args = new NotifyCollectionChangedEventArgs(action, item, index); CollectionChanged(this, args); } } #endregion Private Methods //-------------------------------------------------------------------- // // Private Fields // //--------------------------------------------------------------------- #region Private Fields private List _internalList; #endregion Private Fields } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PointCollectionValueSerializer.cs
- XmlCountingReader.cs
- ImageMapEventArgs.cs
- Control.cs
- ConfigurationLockCollection.cs
- GroupLabel.cs
- XmlLanguageConverter.cs
- SoapEnvelopeProcessingElement.cs
- PropertyAccessVisitor.cs
- CopyAttributesAction.cs
- CellTreeNode.cs
- SemaphoreSecurity.cs
- OracleCommandBuilder.cs
- List.cs
- SRGSCompiler.cs
- RemoteWebConfigurationHostStream.cs
- ColumnMapTranslator.cs
- ComboBoxRenderer.cs
- ModelServiceImpl.cs
- CanonicalFontFamilyReference.cs
- ErrorRuntimeConfig.cs
- KeyInterop.cs
- Solver.cs
- ClientBase.cs
- EnumDataContract.cs
- GAC.cs
- ClientUtils.cs
- BinaryKeyIdentifierClause.cs
- DataGridTable.cs
- ToolStripInSituService.cs
- DataGridViewBindingCompleteEventArgs.cs
- ListBoxDesigner.cs
- FilterElement.cs
- followingsibling.cs
- localization.cs
- _SingleItemRequestCache.cs
- ButtonField.cs
- TickBar.cs
- BypassElement.cs
- InvalidDataException.cs
- EntityDataSourceState.cs
- ScriptManagerProxy.cs
- Panel.cs
- ViewManager.cs
- BaseHashHelper.cs
- XmlTextAttribute.cs
- StringOutput.cs
- QueryStringParameter.cs
- CapiHashAlgorithm.cs
- DeflateInput.cs
- RegexCompiler.cs
- ReferentialConstraint.cs
- ConfigXmlComment.cs
- WindowsTab.cs
- GPRECTF.cs
- DictionaryBase.cs
- ApplicationCommands.cs
- SchemaImporterExtensionsSection.cs
- NGCUIElementCollectionSerializerAsync.cs
- FileStream.cs
- ChildTable.cs
- FixedDSBuilder.cs
- Decimal.cs
- UrlMapping.cs
- ProfilePropertyMetadata.cs
- AndCondition.cs
- Dispatcher.cs
- COAUTHINFO.cs
- BuildResultCache.cs
- VirtualPathData.cs
- DataGridItemCollection.cs
- DbDataAdapter.cs
- DiscoveryExceptionDictionary.cs
- StringArrayEditor.cs
- AccessedThroughPropertyAttribute.cs
- KnownTypes.cs
- unsafeIndexingFilterStream.cs
- XmlAtomicValue.cs
- XpsImage.cs
- ImagingCache.cs
- SecurityHelper.cs
- DefaultAssemblyResolver.cs
- SchemaMapping.cs
- TreeNodeCollection.cs
- ListSortDescription.cs
- ControlParameter.cs
- SecureEnvironment.cs
- WebPartConnectionCollection.cs
- ChangeBlockUndoRecord.cs
- EdmScalarPropertyAttribute.cs
- ComponentResourceManager.cs
- FloatAverageAggregationOperator.cs
- ObjectSet.cs
- AdapterDictionary.cs
- StatusBarPanelClickEvent.cs
- X509ChainElement.cs
- WindowsAuthenticationModule.cs
- SecurityDescriptor.cs
- UIElementHelper.cs
- Crypto.cs