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
- IResourceProvider.cs
- ConfigurationValues.cs
- SqlUdtInfo.cs
- RenderingEventArgs.cs
- CodeMethodInvokeExpression.cs
- WsatAdminException.cs
- AdRotator.cs
- ScrollEvent.cs
- RegexCapture.cs
- OleDbPropertySetGuid.cs
- HttpDebugHandler.cs
- IteratorDescriptor.cs
- DesignerActionKeyboardBehavior.cs
- TypedOperationInfo.cs
- DataServiceRequestOfT.cs
- DoubleLinkListEnumerator.cs
- Int64AnimationBase.cs
- DataControlButton.cs
- Table.cs
- WebControlAdapter.cs
- Condition.cs
- _ScatterGatherBuffers.cs
- PolicyLevel.cs
- XmlSerializerOperationBehavior.cs
- UnsafeNativeMethods.cs
- WmlLabelAdapter.cs
- ParallelTimeline.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- SelectingProviderEventArgs.cs
- SqlXml.cs
- XsltContext.cs
- QilXmlWriter.cs
- NativeMethodsOther.cs
- DataGridTableCollection.cs
- WebPartTransformerCollection.cs
- BindingOperations.cs
- ReadOnlyCollection.cs
- MbpInfo.cs
- MetadataWorkspace.cs
- TextContainerChangedEventArgs.cs
- TextTreeTextBlock.cs
- SchemaTypeEmitter.cs
- OleDbRowUpdatedEvent.cs
- PtsCache.cs
- x509store.cs
- SecurityContextSecurityToken.cs
- TreeNodeMouseHoverEvent.cs
- CodeMethodInvokeExpression.cs
- UserControlBuildProvider.cs
- XmlReturnReader.cs
- BrowserTree.cs
- XamlReader.cs
- SizeConverter.cs
- NativeWrapper.cs
- CollaborationHelperFunctions.cs
- RuntimeArgumentHandle.cs
- XmlIgnoreAttribute.cs
- RequestQueue.cs
- StoreItemCollection.cs
- _KerberosClient.cs
- TaiwanLunisolarCalendar.cs
- InternalDispatchObject.cs
- OleDbSchemaGuid.cs
- AssociationEndMember.cs
- DataObjectEventArgs.cs
- SignatureHelper.cs
- ActivationArguments.cs
- Point3DValueSerializer.cs
- MetabaseSettingsIis7.cs
- ParameterReplacerVisitor.cs
- EnvelopedPkcs7.cs
- DetailsViewCommandEventArgs.cs
- CodeDOMProvider.cs
- ContourSegment.cs
- baseaxisquery.cs
- Type.cs
- RangeExpression.cs
- CustomLineCap.cs
- FileLoadException.cs
- ObjectAnimationUsingKeyFrames.cs
- ConfigXmlWhitespace.cs
- TraceInternal.cs
- GenericUriParser.cs
- VersionedStream.cs
- ApplicationCommands.cs
- DocumentXPathNavigator.cs
- EpmCustomContentSerializer.cs
- MissingMemberException.cs
- Win32SafeHandles.cs
- TimeSpan.cs
- MulticastNotSupportedException.cs
- HostingEnvironmentException.cs
- InvalidWorkflowException.cs
- TraceData.cs
- AtomServiceDocumentSerializer.cs
- DocumentViewerAutomationPeer.cs
- OutputCacheEntry.cs
- AssertFilter.cs
- RegisteredDisposeScript.cs
- Equal.cs