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 IEnumerator GetEnumerator()
{
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 IEnumerator GetEnumerator()
{
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
- XmlToDatasetMap.cs
- ActivationProxy.cs
- HtmlInputFile.cs
- SuppressMergeCheckAttribute.cs
- Script.cs
- autovalidator.cs
- ToolZone.cs
- arabicshape.cs
- RichTextBoxConstants.cs
- LinqToSqlWrapper.cs
- DoubleLink.cs
- AuthorizationRule.cs
- ControlAdapter.cs
- GenericXmlSecurityTokenAuthenticator.cs
- BuildResultCache.cs
- RTLAwareMessageBox.cs
- indexingfiltermarshaler.cs
- SuppressMessageAttribute.cs
- KeyPressEvent.cs
- AttributeQuery.cs
- DataGridViewEditingControlShowingEventArgs.cs
- EditableTreeList.cs
- XmlnsPrefixAttribute.cs
- DataGridViewRowPrePaintEventArgs.cs
- MenuCommandService.cs
- SiblingIterators.cs
- IApplicationTrustManager.cs
- ConfigurationException.cs
- SerializationEventsCache.cs
- XmlEntityReference.cs
- Int32Rect.cs
- DataGridTableStyleMappingNameEditor.cs
- RegistryKey.cs
- invalidudtexception.cs
- SQLBytesStorage.cs
- CharacterBuffer.cs
- EntityFunctions.cs
- DefaultValidator.cs
- ApplicationBuildProvider.cs
- Window.cs
- ZoneButton.cs
- TextEditorSelection.cs
- PeerNameRecord.cs
- WindowProviderWrapper.cs
- Thread.cs
- ObjectTag.cs
- ClockController.cs
- HtmlInputSubmit.cs
- MappedMetaModel.cs
- PresentationTraceSources.cs
- Helpers.cs
- WebConfigurationManager.cs
- COAUTHINFO.cs
- VersionUtil.cs
- PropertyValueChangedEvent.cs
- ControlTemplate.cs
- XslException.cs
- AnnotationResourceCollection.cs
- EmptyQuery.cs
- TableParagraph.cs
- SchemaUtility.cs
- DescendantOverDescendantQuery.cs
- MultiView.cs
- GradientStop.cs
- BlurBitmapEffect.cs
- DuplicateDetector.cs
- NameValuePermission.cs
- PriorityBindingExpression.cs
- DynamicRouteExpression.cs
- RootBrowserWindow.cs
- BitVec.cs
- MediaTimeline.cs
- LicenseManager.cs
- TemplateBindingExpressionConverter.cs
- ListViewContainer.cs
- SystemIPv4InterfaceProperties.cs
- ADConnectionHelper.cs
- DataGridViewCellMouseEventArgs.cs
- UserPreferenceChangedEventArgs.cs
- Serializer.cs
- DataKey.cs
- CustomErrorsSection.cs
- CrossSiteScriptingValidation.cs
- _AutoWebProxyScriptWrapper.cs
- SafeProcessHandle.cs
- TransportBindingElementImporter.cs
- WindowsListViewSubItem.cs
- SqlInternalConnection.cs
- PageStatePersister.cs
- CompilationPass2TaskInternal.cs
- ToolZoneDesigner.cs
- Helper.cs
- MaskedTextBox.cs
- TagElement.cs
- IdnElement.cs
- XslVisitor.cs
- TextParagraphCache.cs
- SqlFactory.cs
- Authorization.cs
- BoundsDrawingContextWalker.cs