Class SkeletonCollection<T>
Base class for collections used in a FileSkeleton.
Inherited Members
Namespace: Sdl.Core.Bcm.BcmModel.Skeleton
Assembly: Sdl.Core.Bcm.BcmModel.dll
Syntax
public class SkeletonCollection<T> : KeyedCollection<SkeletonCollectionKey, T>, IList<T>, ICollection<T>, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, IEquatable<SkeletonCollection<T>> where T : SkeletonItem
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
SkeletonCollection()
Declaration
public SkeletonCollection()
Properties
IdGenerator
Gets the IdGenerator.
Declaration
public IdGenerator IdGenerator { get; }
Property Value
| Type | Description |
|---|---|
| IdGenerator | The IdGenerator. |
ParentSkeleton
Gets or sets the parent FileSkeleton.
Declaration
public FileSkeleton ParentSkeleton { get; set; }
Property Value
| Type | Description |
|---|---|
| FileSkeleton | The parent FileSkeleton. |
Methods
ClearItems()
Removes all elements from the KeyedCollection<TKey, TItem>.
Declaration
protected override void ClearItems()
Overrides
Equals(SkeletonCollection<T>)
Performs a deep-equals comparison.
System.Object.Equals(object)
Declaration
public bool Equals(SkeletonCollection<T> other)
Parameters
| Type | Name | Description |
|---|---|---|
| SkeletonCollection<T> | other |
Returns
| Type | Description |
|---|---|
| bool |
GetById(int)
Gets an element by its numerical id.
Declaration
public T GetById(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | The id. |
Returns
| Type | Description |
|---|---|
| T | If found, returns the element with the Id |
GetKeyForItem(T)
Extracts the key from the specified element.
Declaration
protected override SkeletonCollectionKey GetKeyForItem(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | The element from which to extract the key. |
Returns
| Type | Description |
|---|---|
| SkeletonCollectionKey | The key for the specified element. |
Overrides
GetOrAdd(T)
Gets the element if it already exists in the collection. Otherwise, it is added to the collection and gives it the next ID in the IdGenerator sequence.
Declaration
public T GetOrAdd(T elem)
Parameters
| Type | Name | Description |
|---|---|---|
| T | elem | The element. |
Returns
| Type | Description |
|---|---|
| T | The existing element; or the newly added one with an Id set. |
GetOrAddWithExistingId(T)
Gets the element if it already exists in the collection. Otherwise, it is added to the collection (preserving its existing ID).
Declaration
public T GetOrAddWithExistingId(T elem)
Parameters
| Type | Name | Description |
|---|---|---|
| T | elem | The element. |
Returns
| Type | Description |
|---|---|
| T | The existing element; or the newly added one with an Id set. |
InsertItem(int, T)
Inserts an element into the KeyedCollection<TKey, TItem> at the specified index.
Declaration
protected override void InsertItem(int index, T item)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index at which |
| T | item | The object to insert. |
Overrides
RemoveItem(int)
Removes the element at the specified index of the KeyedCollection<TKey, TItem>.
Declaration
protected override void RemoveItem(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index of the element to remove. |
Overrides
SetItem(int, T)
Replaces the item at the specified index with the specified item.
Declaration
protected override void SetItem(int index, T item)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index of the item to be replaced. |
| T | item | The new item. |