Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- PointLight.cs
- OracleRowUpdatedEventArgs.cs
- Subtree.cs
- Query.cs
- MarshalByRefObject.cs
- GlobalizationSection.cs
- Lookup.cs
- HttpRawResponse.cs
- storepermission.cs
- LabelInfo.cs
- ScrollBarAutomationPeer.cs
- HttpResponseWrapper.cs
- TimelineGroup.cs
- ToolBar.cs
- XmlElementList.cs
- LocatorBase.cs
- SplineQuaternionKeyFrame.cs
- BoundPropertyEntry.cs
- InputReferenceExpression.cs
- HideDisabledControlAdapter.cs
- MetadataException.cs
- SqlDependency.cs
- WebServiceEndpoint.cs
- GatewayDefinition.cs
- NavigatingCancelEventArgs.cs
- ScrollBarAutomationPeer.cs
- System.Data_BID.cs
- CompareInfo.cs
- XPathSingletonIterator.cs
- XsltOutput.cs
- HandlerBase.cs
- XmlResolver.cs
- Facet.cs
- EntityDataSourceColumn.cs
- XPathPatternParser.cs
- WebServiceData.cs
- HttpClientCertificate.cs
- WebBrowserUriTypeConverter.cs
- ConditionBrowserDialog.cs
- BaseTemplateBuildProvider.cs
- NavigatingCancelEventArgs.cs
- BamlMapTable.cs
- Executor.cs
- MouseActionValueSerializer.cs
- PropertyEmitter.cs
- AccessedThroughPropertyAttribute.cs
- UTF32Encoding.cs
- PathData.cs
- TakeQueryOptionExpression.cs
- ComponentFactoryHelpers.cs
- MobileContainerDesigner.cs
- DefaultPrintController.cs
- CodeSnippetExpression.cs
- StringConcat.cs
- FixedHyperLink.cs
- Operators.cs
- ClientProxyGenerator.cs
- ILGenerator.cs
- BuildProviderUtils.cs
- EntityClientCacheEntry.cs
- FieldInfo.cs
- DuplexSecurityProtocolFactory.cs
- TrackBar.cs
- BufferAllocator.cs
- DataGridViewEditingControlShowingEventArgs.cs
- WindowsToolbarAsMenu.cs
- OnOperation.cs
- CompositionAdorner.cs
- DetailsView.cs
- CachingHintValidation.cs
- Label.cs
- SAPICategories.cs
- DecoderBestFitFallback.cs
- WindowsMenu.cs
- DataViewSetting.cs
- odbcmetadatacolumnnames.cs
- BlockCollection.cs
- XsltArgumentList.cs
- CrossSiteScriptingValidation.cs
- DataControlFieldHeaderCell.cs
- DbProviderManifest.cs
- XmlNodeWriter.cs
- UInt64Storage.cs
- OleDbSchemaGuid.cs
- EntityCommandDefinition.cs
- OrCondition.cs
- OleDbPropertySetGuid.cs
- TextInfo.cs
- XslNumber.cs
- CodeArgumentReferenceExpression.cs
- JsonFormatWriterGenerator.cs
- BindingContext.cs
- mda.cs
- OdbcConnectionStringbuilder.cs
- safelinkcollection.cs
- EventRouteFactory.cs
- TaskbarItemInfo.cs
- NoResizeHandleGlyph.cs
- Matrix.cs
- sqlpipe.cs