Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Documents / DocumentReferenceCollection.cs / 1305600 / 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
- EpmCustomContentSerializer.cs
- VersionPair.cs
- SecurityTokenReferenceStyle.cs
- FormsAuthenticationUser.cs
- SystemBrushes.cs
- ColumnReorderedEventArgs.cs
- TemplateControlParser.cs
- DataGridViewSelectedCellCollection.cs
- safemediahandle.cs
- DbSourceCommand.cs
- ToolboxDataAttribute.cs
- Assembly.cs
- SaveFileDialog.cs
- PointAnimationUsingPath.cs
- Typeface.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- MarkupObject.cs
- HotSpotCollection.cs
- PropertyCollection.cs
- PageResolution.cs
- Emitter.cs
- AppDomainUnloadedException.cs
- IndexExpression.cs
- ClientBuildManagerCallback.cs
- ValidatorUtils.cs
- QilGenerator.cs
- ProfileSettings.cs
- XmlDsigSep2000.cs
- ToolstripProfessionalRenderer.cs
- QueryableDataSource.cs
- EntityStoreSchemaFilterEntry.cs
- _IPv6Address.cs
- VirtualPathProvider.cs
- TextRangeEdit.cs
- AttributeQuery.cs
- QfeChecker.cs
- WebPartVerbsEventArgs.cs
- EditorBrowsableAttribute.cs
- unsafeIndexingFilterStream.cs
- XamlSerializerUtil.cs
- AssociationSetEnd.cs
- HotSpotCollection.cs
- XPathParser.cs
- PopupRootAutomationPeer.cs
- SubordinateTransaction.cs
- datacache.cs
- StrongName.cs
- SoapFault.cs
- IntellisenseTextBox.designer.cs
- HtmlInputImage.cs
- InboundActivityHelper.cs
- CreateUserWizard.cs
- TakeQueryOptionExpression.cs
- ToolStripLocationCancelEventArgs.cs
- DataSetViewSchema.cs
- InputElement.cs
- DataColumn.cs
- XmlBaseReader.cs
- WebPartConnectionsDisconnectVerb.cs
- _emptywebproxy.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- SmtpDigestAuthenticationModule.cs
- SystemSounds.cs
- ListViewItemEventArgs.cs
- XmlSchemaGroup.cs
- InheritanceAttribute.cs
- BindingContext.cs
- MenuCommand.cs
- ObjectDataSourceView.cs
- ProfilePropertySettings.cs
- PointValueSerializer.cs
- ArrayConverter.cs
- AssemblyBuilder.cs
- GifBitmapEncoder.cs
- ComponentEvent.cs
- EmptyTextWriter.cs
- PassportAuthenticationEventArgs.cs
- AuthenticationModuleElement.cs
- NativeMethods.cs
- ItemContainerGenerator.cs
- StringReader.cs
- OracleInfoMessageEventArgs.cs
- QilTypeChecker.cs
- XmlEntity.cs
- LocalizationComments.cs
- SecurityPermission.cs
- EntityContainerEmitter.cs
- CombinedGeometry.cs
- CodeMemberField.cs
- assertwrapper.cs
- CodeIndexerExpression.cs
- sqlpipe.cs
- versioninfo.cs
- InstanceValue.cs
- SelectingProviderEventArgs.cs
- ThumbButtonInfoCollection.cs
- CodeTypeMember.cs
- CheckBox.cs
- IdentifierCreationService.cs
- Sequence.cs