Class SkeletonCollection<T>
Base class for collections used in a FileSkeleton.
Inheritance
Implements
Namespace: Sdl.Core.Bcm.BcmModel.Skeleton
Assembly: Sdl.Core.Bcm.BcmModel.dll
Syntax
public class SkeletonCollection<T> : KeyedCollection<SkeletonCollectionKey, 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 System.Collections.ObjectModel.KeyedCollection`2.
Declaration
protected override void ClearItems()
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 |
---|---|
System.Boolean |
GetById(Int32)
Gets an element by its numerical id.
Declaration
public T GetById(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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. |
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(Int32, T)
Inserts an element into the System.Collections.ObjectModel.KeyedCollection`2 at the specified index.
Declaration
protected override void InsertItem(int index, T item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which |
T | item | The object to insert. |
RemoveItem(Int32)
Removes the element at the specified index of the System.Collections.ObjectModel.KeyedCollection`2.
Declaration
protected override void RemoveItem(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the element to remove. |
SetItem(Int32, 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 |
---|---|---|
System.Int32 | index | The zero-based index of the item to be replaced. |
T | item | The new item. |