Partager via


LinkedElementCollection<T> Class

Provides a collection of all elements that are linked to an element.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Modeling.ReadOnlyLinkedElementCollection<T>
    Microsoft.VisualStudio.Modeling.LinkedElementCollection<T>

Namespace:  Microsoft.VisualStudio.Modeling
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.10.0.dll)

Syntax

'Déclaration
Public Class LinkedElementCollection(Of T As ModelElement) _
    Inherits ReadOnlyLinkedElementCollection(Of T) _
    Implements IList(Of T), ICollection(Of T),  _
    IEnumerable(Of T), IBindingList, IList, ICollection, IEnumerable
public class LinkedElementCollection<T> : ReadOnlyLinkedElementCollection<T>, 
    IList<T>, ICollection<T>, IEnumerable<T>, IBindingList, IList, 
    ICollection, IEnumerable
where T : ModelElement
generic<typename T>
where T : ModelElement
public ref class LinkedElementCollection : public ReadOnlyLinkedElementCollection<T>, 
    IList<T>, ICollection<T>, IEnumerable<T>, IBindingList, IList, 
    ICollection, IEnumerable
type LinkedElementCollection<'T when 'T : ModelElement> =  
    class
        inherit ReadOnlyLinkedElementCollection<'T>
        interface IList<'T>
        interface ICollection<'T>
        interface IEnumerable<'T>
        interface IBindingList
        interface IList
        interface ICollection
        interface IEnumerable
    end
JScript does not support generic types or methods.

Type Parameters

  • T

The LinkedElementCollection<T> type exposes the following members.

Constructors

  Name Description
Protected method LinkedElementCollection<T>() Initializes a new instance of the LinkedElementCollection<T> class used for data binding.
Public method LinkedElementCollection<T>(ModelElement, Guid) Initializes a new instance of the LinkedElementCollection<T> class for a specified element.

Top

Properties

  Name Description
Public property CommittedCount Gets the actual number of role players in collection (after commit) (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public property Count Gets the number of role players in the collection. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public property IntermediateCount Gets the intermediate number of role players in collection(during commit). (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public property Item Gets or sets the role at a specified index in a collection of linked elements.
Public property SourceDomainRole Gets the source role of the relationship that this collection represents. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public property SourceElement Gets the source role player which was inherited by this collection. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public property TargetDomainRole Gets the target role of the relationship that this collection represents. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Protected property TypeForAddNew

Top

Methods

  Name Description
Public method Add Appends a new role to the end of the collection.
Public method AddNew Add and merge in a new element to the collection
Protected method AddNewCore Common implementation of logic to add and merge in a new element to the collection
Public method AddRange Appends a range of elements to the end of the collection.
Public method AsReadOnly Gets a read-only collection of linked elements.
Public method Clear Removes all roles from the collection.
Public method Contains Gets whether a specified role player belongs to the collection. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public method CopyTo Copies all role players to an array. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public method Exists Determines whether there is at least one element for which a given condition is true. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method Find Finds the first element in the collection which matches a given condition. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public method FindAll Finds all elements which satisfy a given condition. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public method FindIndex Finds the first element which satisfies a given condition. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public method ForEach Runs the specified action on all elements in the collection. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public method GetEnumerator Gets a strongly-typed enumerator for this collection. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Protected method GetItemProperties Returns a complete set of browsable properties for the item type of the collection. If real items exists in the collection, then replace the reflective ones with IMS ones where possible to allow transacted updates through them. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IndexOf Gets the index of a role player inside the collection. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public method Insert Inserts a role into the collection at a specified index.
Public method InsertRange Inserts a range of elements into the collection at a specific index.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Move(Int32, Int32) Moves a role to a new position inside the collection.
Public method Move(T, Int32) Moves a role to a new position inside the collection.
Public method Remove Removes the specified role from the collection.
Public method RemoveAt Removes the role at a specified index from the collection.
Public method RemoveRange Removes a range of elements from the collection.
Public method ReplaceAt Replaces a role at a specified index with a new role.
Public method Sort() Sorts the elements in the collection of element links.
Public method Sort(IComparer<T>) Sorts the elements in the collection of element links.
Public method Sort(Comparison<T>) Sorts the elements in the collection of element links.
Public method Sort(Int32, Int32, IComparer<T>) Sorts a range of elements in the collection of element links.
Public method ToArray Creates an array and copies all role players in the collection into it. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method TrueForAll Checks if a given condition is true for all elements in the collection. (Inherited from ReadOnlyLinkedElementCollection<T>.)

Top

Fields

  Name Description
Protected field listChangedHandler (Inherited from ReadOnlyLinkedElementCollection<T>.)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IList.Add
Explicit interface implemetationPrivate method ICollection<T>.Add (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IBindingList.AddIndex Adds the specified property to the set used for indexing the collection when it is searched. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IBindingList.AddNew Creates a new element.
Explicit interface implemetationPrivate property IBindingList.AllowEdit
Explicit interface implemetationPrivate property IBindingList.AllowNew
Explicit interface implemetationPrivate property IBindingList.AllowRemove
Explicit interface implemetationPrivate method IBindingList.ApplySort This method is not supported. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method ICollection<T>.Clear (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IList.Clear (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate event INotifyCollectionChanged.CollectionChanged (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IList.Contains
Explicit interface implemetationPrivate method ICollection.CopyTo (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IBindingList.Find This method is not supported. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IEnumerable<T>.GetEnumerator (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IEnumerable.GetEnumerator (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method ITypedList.GetItemProperties Returns a complete set of browsable properties for the item type of the collection. If real items exists in the collection, then replace the reflective ones with IMS ones where possible to allow transacted updates through them. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method ITypedList.GetListName Returns the name of the list. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IList.IndexOf (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IList.Insert
Explicit interface implemetationPrivate method IList<T>.Insert (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate property IList.IsFixedSize (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate property ICollection<T>.IsReadOnly
Explicit interface implemetationPrivate property IList.IsReadOnly
Explicit interface implemetationPrivate property IBindingList.IsSorted (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate property ICollection.IsSynchronized (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate property IList.Item
Explicit interface implemetationPrivate event IBindingList.ListChanged ListChange Event
Explicit interface implemetationPrivate event INotifyPropertyChanged.PropertyChanged (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate property IRaiseItemChangedEvents.RaisesItemChangedEvents (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IList.Remove
Explicit interface implemetationPrivate method ICollection<T>.Remove (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IList<T>.RemoveAt (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IList.RemoveAt (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IBindingList.RemoveIndex This method is not supported. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate method IBindingList.RemoveSort This method is not supported. (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate property IBindingList.SortDirection (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate property IBindingList.SortProperty (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate property IBindingList.SupportsChangeNotification
Explicit interface implemetationPrivate property IBindingList.SupportsSearching (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate property IBindingList.SupportsSorting (Inherited from ReadOnlyLinkedElementCollection<T>.)
Explicit interface implemetationPrivate property ICollection.SyncRoot (Inherited from ReadOnlyLinkedElementCollection<T>.)

Top

Remarks

This is a strongly typed collection that refers to the opposite element instances for a relationship in which a particular element participates.

This collection provides navigation to all elements linked to an element.

Examples

This example assumes class A can have a multiplicity of class B instances. Also, class A has a property named C that represents elements linked to an instance of A.

// A a;
// B b1, b2, b3;
LinkedElementCollection<B> elementsLinkedToA = a.C;

// If class A has a multiplicity allowing only one B, the property type will be B.
// B elementLinkedToA = a.B;

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Modeling Namespace