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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ImageDrawing.cs
- DataListDesigner.cs
- SafeSecurityHelper.cs
- SQLUtility.cs
- SafeNativeMethods.cs
- ServiceDescriptions.cs
- AbstractSvcMapFileLoader.cs
- HttpModule.cs
- ResourceDictionary.cs
- XDRSchema.cs
- CompoundFileDeflateTransform.cs
- TextElementCollectionHelper.cs
- ToolBarOverflowPanel.cs
- XmlSchemaSimpleTypeList.cs
- ManifestBasedResourceGroveler.cs
- IntranetCredentialPolicy.cs
- ConnectivityStatus.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- GridViewSelectEventArgs.cs
- PassportAuthentication.cs
- TemplatingOptionsDialog.cs
- EntityFunctions.cs
- WebEventTraceProvider.cs
- ThreadStaticAttribute.cs
- CompressStream.cs
- DataGridItem.cs
- ExpressionConverter.cs
- Logging.cs
- ExtensionSimplifierMarkupObject.cs
- AmbientValueAttribute.cs
- ObjectSecurity.cs
- ExpressionBinding.cs
- PreProcessInputEventArgs.cs
- TextDecorationCollection.cs
- WebHttpSecurity.cs
- StateChangeEvent.cs
- RegexFCD.cs
- WizardForm.cs
- wgx_render.cs
- PropertySegmentSerializer.cs
- SmtpReplyReaderFactory.cs
- SqlDataSourceView.cs
- Soap11ServerProtocol.cs
- ControlParameter.cs
- DeviceContexts.cs
- BitmapEffectGroup.cs
- PixelFormats.cs
- ServiceReference.cs
- CollectionViewGroup.cs
- GenericTypeParameterConverter.cs
- StrongNameMembershipCondition.cs
- TimeZoneNotFoundException.cs
- XmlRawWriter.cs
- TextEndOfLine.cs
- ApplicationActivator.cs
- ResourceProviderFactory.cs
- LayoutTableCell.cs
- PageCodeDomTreeGenerator.cs
- XmlSchemaComplexContentRestriction.cs
- GPStream.cs
- SmiContext.cs
- XamlSerializerUtil.cs
- ReadOnlyNameValueCollection.cs
- GridItemCollection.cs
- baseshape.cs
- MouseDevice.cs
- ServiceModelPerformanceCounters.cs
- HttpProfileGroupBase.cs
- Decimal.cs
- MonthCalendarDesigner.cs
- TreeNodeStyle.cs
- PathFigureCollection.cs
- formatstringdialog.cs
- SortableBindingList.cs
- TextClipboardData.cs
- MinMaxParagraphWidth.cs
- AccessibleObject.cs
- ConfigXmlReader.cs
- ExternalCalls.cs
- MobileUserControl.cs
- XmlTextWriter.cs
- SqlDependencyListener.cs
- ObjectDataSourceMethodEventArgs.cs
- RestClientProxyHandler.cs
- BooleanExpr.cs
- MonthChangedEventArgs.cs
- JournalEntryListConverter.cs
- MailHeaderInfo.cs
- TextBoxAutomationPeer.cs
- RegistrationServices.cs
- Attribute.cs
- MobileErrorInfo.cs
- PhysicalFontFamily.cs
- Action.cs
- Span.cs
- DockAndAnchorLayout.cs
- StateRuntime.cs
- FactoryMaker.cs
- DataGridViewColumnConverter.cs
- BufferedGraphics.cs