Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- RuleProcessor.cs
- uribuilder.cs
- DPAPIProtectedConfigurationProvider.cs
- SQLDecimal.cs
- UntypedNullExpression.cs
- AuthenticationException.cs
- MessagePartDescription.cs
- LinkedResource.cs
- FieldAccessException.cs
- OleDbRowUpdatingEvent.cs
- CheckBoxBaseAdapter.cs
- DependencySource.cs
- MenuItemCollection.cs
- SplitterCancelEvent.cs
- SqlCacheDependencySection.cs
- SoapAttributes.cs
- DbConnectionStringBuilder.cs
- CorruptStoreException.cs
- SettingsPropertyValueCollection.cs
- SmtpAuthenticationManager.cs
- FormattedTextSymbols.cs
- Msmq3PoisonHandler.cs
- MultilineStringConverter.cs
- PerformanceCounterLib.cs
- CodeDirectiveCollection.cs
- AnimationException.cs
- WindowsToolbarItemAsMenuItem.cs
- Listbox.cs
- GridViewCommandEventArgs.cs
- X509CertificateCollection.cs
- MarkupCompiler.cs
- ReplyChannel.cs
- HttpGetProtocolReflector.cs
- ServiceSecurityAuditBehavior.cs
- HideDisabledControlAdapter.cs
- StringAnimationBase.cs
- MessageQueuePermissionEntry.cs
- CharacterHit.cs
- LeftCellWrapper.cs
- MimeTypeMapper.cs
- NavigationWindowAutomationPeer.cs
- ThreadExceptionEvent.cs
- PostBackOptions.cs
- EntityModelSchemaGenerator.cs
- DbConnectionHelper.cs
- DiagnosticTrace.cs
- Canonicalizers.cs
- ListMarkerLine.cs
- ConfigurationException.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- DescendantQuery.cs
- ServiceDescriptionImporter.cs
- AggregateNode.cs
- CompositionDesigner.cs
- PreDigestedSignedInfo.cs
- PTManager.cs
- Point.cs
- Rotation3D.cs
- CloseCollectionAsyncResult.cs
- HttpChannelBindingToken.cs
- Debug.cs
- DynamicUpdateCommand.cs
- ResXResourceWriter.cs
- CacheForPrimitiveTypes.cs
- UnitySerializationHolder.cs
- MgmtConfigurationRecord.cs
- DataContractJsonSerializer.cs
- SpecialFolderEnumConverter.cs
- Query.cs
- BindingValueChangedEventArgs.cs
- ScrollableControl.cs
- Walker.cs
- EdgeProfileValidation.cs
- WindowsGraphicsWrapper.cs
- GrammarBuilderWildcard.cs
- WebServiceParameterData.cs
- BeginStoryboard.cs
- PeerNearMe.cs
- PrePostDescendentsWalker.cs
- _LocalDataStoreMgr.cs
- ISFTagAndGuidCache.cs
- UpdateRecord.cs
- DesignParameter.cs
- ElapsedEventArgs.cs
- WmlCalendarAdapter.cs
- StrokeNodeOperations.cs
- DockingAttribute.cs
- StorageConditionPropertyMapping.cs
- ItemCheckEvent.cs
- InkCanvas.cs
- SqlClientWrapperSmiStream.cs
- ExceptionHelpers.cs
- StrokeNodeOperations2.cs
- TimeoutException.cs
- UTF7Encoding.cs
- UnitySerializationHolder.cs
- StringOutput.cs
- SqlDataSource.cs
- CommonObjectSecurity.cs
- OutputCacheSettingsSection.cs